You are here

public function AdministerMenus::blockForm in Total Control Admin Dashboard 8.2

Same name and namespace in other branches
  1. 3.0.x src/Plugin/Block/AdministerMenus.php \Drupal\total_control\Plugin\Block\AdministerMenus::blockForm()

Returns the configuration form elements specific to this block plugin.

Blocks that need to add form elements to the normal block configuration form should implement this method.

Parameters

array $form: The form definition array for the block configuration form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The renderable form array representing the entire configuration form.

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/AdministerMenus.php, line 210

Class

AdministerMenus
Provides a 'Administer Menus'.

Namespace

Drupal\total_control\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form = parent::blockForm($form, $form_state);
  $config = $this
    ->getConfiguration();
  $menus = menu_ui_get_menus();
  $form['total_control_admin_menus'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Show links for the following menus on the dashboard'),
    '#options' => $menus,
    '#default_value' => $config['total_control_admin_menus'],
  ];
  return $form;
}