public function LayoutRebuildConfirmFormBase::buildForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/Form/LayoutRebuildConfirmFormBase.php \Drupal\layout_builder\Form\LayoutRebuildConfirmFormBase::buildForm()
- 9 core/modules/layout_builder/src/Form/LayoutRebuildConfirmFormBase.php \Drupal\layout_builder\Form\LayoutRebuildConfirmFormBase::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfirmFormBase::buildForm
1 method overrides LayoutRebuildConfirmFormBase::buildForm()
- RemoveBlockForm::buildForm in core/
modules/ layout_builder/ src/ Form/ RemoveBlockForm.php - Form constructor.
File
- core/
modules/ layout_builder/ src/ Form/ LayoutRebuildConfirmFormBase.php, line 76
Class
- LayoutRebuildConfirmFormBase
- Provides a base class for confirmation forms that rebuild the Layout Builder.
Namespace
Drupal\layout_builder\FormCode
public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL) {
$this->sectionStorage = $section_storage;
$this->delta = $delta;
$form = parent::buildForm($form, $form_state);
if ($this
->isAjax()) {
$form['actions']['submit']['#ajax']['callback'] = '::ajaxSubmit';
$form['actions']['cancel']['#attributes']['class'][] = 'dialog-cancel';
$target_highlight_id = !empty($this->uuid) ? $this
->blockUpdateHighlightId($this->uuid) : $this
->sectionUpdateHighlightId($delta);
$form['#attributes']['data-layout-builder-target-highlight-id'] = $target_highlight_id;
}
// Mark this as an administrative page for JavaScript ("Back to site" link).
$form['#attached']['drupalSettings']['path']['currentPathIsAdmin'] = TRUE;
return $form;
}