You are here

public function ActiveTrail::buildConfigurationForm in Context Active Trail 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/ContextReaction/ActiveTrail.php \Drupal\context_active_trail\Plugin\ContextReaction\ActiveTrail::buildConfigurationForm()

File

src/Plugin/ContextReaction/ActiveTrail.php, line 75

Class

ActiveTrail
Provides a reaction that sets the active trail.

Namespace

Drupal\context_active_trail\Plugin\ContextReaction

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state, ContextInterface $context = NULL) {
  $trail = $this->configuration['trail'];
  $form['trail'] = $this->menuLinkSelector
    ->parentSelectElement($trail);
  $form['breadcrumbs'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Override breadcrumbs'),
    '#description' => $this
      ->t('Override breadcrumbs based on the modified active trail.'),
    '#default_value' => $this->configuration['breadcrumbs'],
  ];
  $form['breadcrumb_title'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show current page title at end'),
    '#description' => $this
      ->t('If your site has a module dedicated to handling breadcrumbs already, ensure this setting is disabled.'),
    '#default_value' => $this->configuration['breadcrumb_title'],
    '#states' => [
      'visible' => [
        ':input[name="reactions[active_trail][breadcrumbs]"]' => [
          'checked' => TRUE,
        ],
      ],
    ],
  ];
  return $form;
}