You are here

public function PagererPresetPaneEditForm::form in Pagerer 8

Same name and namespace in other branches
  1. 8.2 src/Form/PagererPresetPaneEditForm.php \Drupal\pagerer\Form\PagererPresetPaneEditForm::form()

Gets the actual form array to be built.

Overrides PagererPresetFormBase::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

src/Form/PagererPresetPaneEditForm.php, line 66

Class

PagererPresetPaneEditForm
Form handler for Pagerer presets' panes.

Namespace

Drupal\pagerer\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);

  // Pane settings form.
  $form['#title'] = $this
    ->t("%preset_name - @pane pane settings", [
    '%preset_name' => $this->entity
      ->label(),
    '@pane' => $this->paneLabels[$this->pane],
  ]);

  // In pane edit, do not show the preset name.
  $form['id']['#type'] = 'hidden';
  $form['label']['#type'] = 'hidden';

  // Pane style name.
  $plugin_definition = $this->styleManager
    ->getDefinition($this->style);
  $form['style_label'] = [
    '#type' => 'item',
    '#title' => $this
      ->t("Pane style"),
    '#markup' => !empty($plugin_definition) ? $plugin_definition['short_title'] : NULL,
    '#description' => $this
      ->t("To change the pane style, go back to the 'Edit pager' form."),
  ];

  // Get the config piece from the plugin.
  $form['config'] = $this->plugin
    ->buildConfigurationForm($form, $form_state);
  return $form;
}