DeleteGuideBoxForm
extends FormBase
in package
Provides a form for deleting guide boxes.
This form allows administrators to delete guide boxes from the system. It includes a confirmation step to ensure that boxes are not deleted unintentionally. Depending on the context, the form may delete the box entirely or just remove its association with a specific guide.
Table of Contents
Methods
- access() : AccessResult
- Checks if the user can edit their own article.
- buildForm() : array<string|int, mixed>
- Builds the deletion confirmation form.
- getFormId() : string
- {@inheritdoc}
- submitAjax() : AjaxResponse
- Handles AJAX submissions for the deletion form.
- submitForm() : void
- Processes the form submission for guide box deletion.
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 deletion confirmation 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, including the confirmation checkbox and deletion action.
getFormId()
{@inheritdoc}
public
getFormId() : string
Return values
stringsubmitAjax()
Handles AJAX submissions for the deletion form.
public
submitAjax(array<string|int, mixed> &$form, FormStateInterface $form_state) : AjaxResponse
Provides a smoother user experience by processing form submissions via AJAX, offering immediate feedback and avoiding full page reloads.
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 to update the client-side state.
submitForm()
Processes the form submission for guide box deletion.
public
submitForm(array<string|int, mixed> &$form, FormStateInterface $form_state) : void
Executes the deletion based on the user confirmation. If the box is being deleted from its parent, it ensures that all references and child content are also appropriately handled.
Parameters
- $form : array<string|int, mixed>
-
The form array.
- $form_state : FormStateInterface
-
The state of the form.