EditGuideBoxForm
extends FormBase
in package
Form handler for editing a guide box.
Enables users to change the title and publication status of an existing guide box. It checks if the box is being edited within its parent guide context, and if not, it provides a link to the appropriate parent guide for editing.
Table of Contents
Methods
- access() : AccessResult
- Checks if the user can edit their own article.
- buildForm() : array<string|int, mixed>
- Builds the guide box edit form.
- getFormId() : string
- {@inheritdoc}
- submitAjax() : AjaxResponse
- AJAX submission handler for the edit guide box form.
- submitForm() : void
- Processes the submission of the guide box edit form.
Methods
access()
Checks if the user can edit their own article.
public
access(Request $request, AccountInterface $account) : AccessResult
Parameters
- $request : Request
- $account : AccountInterface
Return values
AccessResultbuildForm()
Builds the guide box edit form.
public
buildForm(array<string|int, mixed> $form, FormStateInterface $form_state) : 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.
Return values
array<string|int, mixed> —The form structure.
getFormId()
{@inheritdoc}
public
getFormId() : string
Return values
stringsubmitAjax()
AJAX submission handler for the edit guide box form.
public
submitAjax(array<string|int, mixed> &$form, FormStateInterface $form_state) : AjaxResponse
Processes the form submission using AJAX to provide a smoother user experience by offering immediate feedback without requiring a page refresh.
Parameters
- $form : array<string|int, mixed>
-
The form array.
- $form_state : FormStateInterface
-
The current state of the form.
Tags
Return values
AjaxResponse —An AJAX response for the form submission.
submitForm()
Processes the submission of the guide box edit form.
public
submitForm(array<string|int, mixed> &$form, FormStateInterface $form_state) : void
Updates the title and publication status of the guide box based on user input. It checks if the current guide box can be edited in the current context and performs the update accordingly.
Parameters
- $form : array<string|int, mixed>
-
The form array.
- $form_state : FormStateInterface
-
The state of the form.