function LayoutRebuildConfirmFormBase::buildForm

Same name in other branches
  1. 9 core/modules/layout_builder/src/Form/LayoutRebuildConfirmFormBase.php \Drupal\layout_builder\Form\LayoutRebuildConfirmFormBase::buildForm()
  2. 10 core/modules/layout_builder/src/Form/LayoutRebuildConfirmFormBase.php \Drupal\layout_builder\Form\LayoutRebuildConfirmFormBase::buildForm()
  3. 11.x core/modules/layout_builder/src/Form/LayoutRebuildConfirmFormBase.php \Drupal\layout_builder\Form\LayoutRebuildConfirmFormBase::buildForm()

Overrides ConfirmFormBase::buildForm

1 call to LayoutRebuildConfirmFormBase::buildForm()
RemoveBlockForm::buildForm in core/modules/layout_builder/src/Form/RemoveBlockForm.php
Form constructor.
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\Form

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.