You are here

protected function PageEditWizard::customizeForm in Page Manager 8.4

Same name and namespace in other branches
  1. 8 page_manager_ui/src/Wizard/PageEditWizard.php \Drupal\page_manager_ui\Wizard\PageEditWizard::customizeForm()

Helper function for generating label and id form elements.

Parameters

array $form:

\Drupal\Core\Form\FormStateInterface $form_state:

Return value

array

Overrides EntityFormWizardBase::customizeForm

File

page_manager_ui/src/Wizard/PageEditWizard.php, line 144

Class

PageEditWizard

Namespace

Drupal\page_manager_ui\Wizard

Code

protected function customizeForm(array $form, FormStateInterface $form_state) {
  $cached_values = $form_state
    ->getTemporaryValue('wizard');

  /** @var $page \Drupal\page_manager\Entity\Page */
  $page = $cached_values['page'];

  // The page actions.
  $form['wizard_actions'] = [
    '#theme' => 'links',
    '#links' => [],
    '#attributes' => [
      'class' => [
        'inline',
      ],
    ],
  ];
  foreach ($this
    ->getPageActionLinks($page) as $action) {
    $form['wizard_actions']['#links'][] = $action + [
      'attributes' => [
        'class' => 'use-ajax',
        'data-dialog-type' => 'modal',
        'data-dialog-options' => Json::encode([
          'width' => 700,
        ]),
      ],
    ];
  }

  // The tree of wizard steps.
  $form['wizard_tree'] = [
    '#theme' => [
      'page_manager_wizard_tree',
    ],
    '#wizard' => $this,
    '#cached_values' => $form_state
      ->getTemporaryValue('wizard'),
  ];
  $form['#theme'] = 'page_manager_wizard_form';
  $form['#attached']['library'][] = 'page_manager_ui/admin';
  return $form;
}