You are here

public function LocalTasksBlock::blockForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php \Drupal\Core\Menu\Plugin\Block\LocalTasksBlock::blockForm()
  2. 9 core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php \Drupal\Core\Menu\Plugin\Block\LocalTasksBlock::blockForm()

File

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

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;
}