You are here

public function PanelizerAddWizard::buildForm in Panelizer 8.3

Same name and namespace in other branches
  1. 8.5 src/Wizard/PanelizerAddWizard.php \Drupal\panelizer\Wizard\PanelizerAddWizard::buildForm()
  2. 8.4 src/Wizard/PanelizerAddWizard.php \Drupal\panelizer\Wizard\PanelizerAddWizard::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 FormWizardBase::buildForm

File

src/Wizard/PanelizerAddWizard.php, line 22

Class

PanelizerAddWizard

Namespace

Drupal\panelizer\Wizard

Code

public function buildForm(array $form, FormStateInterface $form_state, $entity_type_id = NULL, $bundle = NULL, $view_mode_name = NULL) {
  if ($entity_type_id && $bundle && $view_mode_name) {
    $form_state
      ->set('machine_name_prefix', "{$entity_type_id}__{$bundle}__{$view_mode_name}");
  }
  $form = parent::buildForm($form, $form_state);
  $cached_values = $form_state
    ->getTemporaryValue('wizard');
  $cached_values['id'] = $this
    ->getMachineName();

  // Some variants like PanelsDisplayVariant need this. Set it to empty.
  $cached_values['access'] = [];
  $form_state
    ->setTemporaryValue('wizard', $cached_values);
  return $form;
}