public function LocalTasksBlock::blockForm in Drupal 9
Same name and namespace in other branches
- 8 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 123
Class
- LocalTasksBlock
- Provides a "Tabs" block to display the local tasks.
Namespace
Drupal\Core\Menu\Plugin\BlockCode
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;
}