ReuseGuidePageForm
extends FormBase
in package
Provides a form for reusing guide pages.
This form allows users to select an existing guide page to either duplicate or create a reference link to, potentially including its subpages.
Table of Contents
Methods
- buildForm() : array<string|int, mixed>
- Builds the reuse guide page form.
- getFormId() : string
- {@inheritdoc}
- IncludeSubCallBack() : array<string|int, mixed>
- AJAX callback for updating form elements based on 'include subpages' selection.
- position_callback() : mixed
- submitAjax() : AjaxResponse
- submitForm() : void
- Handles form submission.
- validateFields() : void
- Validates the form submission.
- get_all_pages() : array<string|int, mixed>
Methods
buildForm()
Builds the reuse guide page form.
public
buildForm(array<string|int, mixed> $form, FormStateInterface $form_state[, array<string|int, mixed>|null $ids = null ]) : array<string|int, mixed>
Parameters
- $form : array<string|int, mixed>
-
An associative array containing the structure of the form.
- $form_state : FormStateInterface
-
The current state of the form.
- $ids : array<string|int, mixed>|null = null
-
(optional) Additional identifiers passed to the form.
Return values
array<string|int, mixed> —The form structure.
getFormId()
{@inheritdoc}
public
getFormId() : string
Return values
stringIncludeSubCallBack()
AJAX callback for updating form elements based on 'include subpages' selection.
public
IncludeSubCallBack(array<string|int, mixed> &$form, FormStateInterface $form_state) : array<string|int, mixed>
Parameters
- $form : array<string|int, mixed>
-
The form render array.
- $form_state : FormStateInterface
-
The form state.
Return values
array<string|int, mixed> —The updated form element.
position_callback()
public
position_callback(array<string|int, mixed> &$form, FormStateInterface $form_state) : mixed
Parameters
- $form : array<string|int, mixed>
- $form_state : FormStateInterface
submitAjax()
public
submitAjax(array<string|int, mixed> &$form, FormStateInterface $form_state) : AjaxResponse
Parameters
- $form : array<string|int, mixed>
- $form_state : FormStateInterface
Tags
Return values
AjaxResponsesubmitForm()
Handles form submission.
public
submitForm(array<string|int, mixed> &$form, FormStateInterface $form_state) : void
Duplicates or references the selected page based on user input and updates the guide structure accordingly.
Parameters
- $form : array<string|int, mixed>
-
The form render array.
- $form_state : FormStateInterface
-
The form state.
validateFields()
Validates the form submission.
public
validateFields(array<string|int, mixed> &$form, FormStateInterface $form_state) : void
Ensures a title is provided for non-reference page creation and prevents creating references within the same guide.
Parameters
- $form : array<string|int, mixed>
-
The form render array.
- $form_state : FormStateInterface
-
The form state.
get_all_pages()
private
get_all_pages(mixed $guide_id) : array<string|int, mixed>
Parameters
- $guide_id : mixed