CreateGuideBoxForm
extends FormBase
in package
Form for creating new guide box entities.
Provides a simple form within the lgmsmodule for creating box entities that can be associated with a guide. These box entities can hold various types of content and are intended to structure guide content into manageable sections.
Table of Contents
Methods
- buildForm() : array<string|int, mixed>
- Builds the create guide box form.
- getFormId() : string
- {@inheritdoc}
- submitAjax() : AjaxResponse
- AJAX callback for the form submission.
- submitForm() : void
- Processes the guide box creation form submission.
Methods
buildForm()
Builds the create guide box form.
public
buildForm(array<string|int, mixed> $form, FormStateInterface $form_state[, mixed $ids = null ]) : array<string|int, mixed>
Parameters
- $form : array<string|int, mixed>
-
An associative array containing the initial structure of the form.
- $form_state : FormStateInterface
-
The current state of the form.
- $ids : mixed = null
-
Optional identifiers for form construction, typically including the parent node ID and other contextual data.
Return values
array<string|int, mixed> —The modified form structure including fields for the box title and publication status.
getFormId()
{@inheritdoc}
public
getFormId() : string
Return values
stringsubmitAjax()
AJAX callback for the form submission.
public
submitAjax(array<string|int, mixed> &$form, FormStateInterface $form_state) : AjaxResponse
Handles the form submission using AJAX to provide a smoother user experience. On success, it provides feedback and may update the user interface to reflect the newly created box entity.
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 object to handle client-side updates.
submitForm()
Processes the guide box creation form submission.
public
submitForm(array<string|int, mixed> &$form, FormStateInterface $form_state) : void
Takes the input from the form, validates it, and uses it to create a new guide box node entity. It associates this box with its parent guide and updates related entities as necessary.
Parameters
- $form : array<string|int, mixed>
-
The form array.
- $form_state : FormStateInterface
-
The state of the form.