function LocalTasksBlock::blockForm

Same name in other branches
  1. 9 core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php \Drupal\Core\Menu\Plugin\Block\LocalTasksBlock::blockForm()
  2. 8.9.x core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php \Drupal\Core\Menu\Plugin\Block\LocalTasksBlock::blockForm()
  3. 11.x core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php \Drupal\Core\Menu\Plugin\Block\LocalTasksBlock::blockForm()

Overrides BlockPluginTrait::blockForm

File

core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php, line 134

Class

LocalTasksBlock
Provides a "Tabs" block to display the local tasks.

Namespace

Drupal\Core\Menu\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
    $config = $this->configuration;
    $defaults = $this->defaultConfiguration();
    $form['levels'] = [
        '#type' => 'details',
        '#title' => $this->t('Shown tabs'),
        '#description' => $this->t('Select tabs being shown in the block'),
        // Open if not set to defaults.
'#open' => $defaults['primary'] !== $config['primary'] || $defaults['secondary'] !== $config['secondary'],
    ];
    $form['levels']['primary'] = [
        '#type' => 'checkbox',
        '#title' => $this->t('Show primary tabs'),
        '#default_value' => $config['primary'],
    ];
    $form['levels']['secondary'] = [
        '#type' => 'checkbox',
        '#title' => $this->t('Show secondary tabs'),
        '#default_value' => $config['secondary'],
    ];
    return $form;
}

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