You are here

public function FootermapBlock::blockForm in footermap: a footer site map 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/FootermapBlock.php, line 151

Class

FootermapBlock
Provide a footer-based site map block based on menu items.

Namespace

Drupal\footermap\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form['footermap_recurse_limit'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Recurse Limit'),
    '#description' => $this
      ->t('Limit the depth of menu items to display. The default is 0, unlimited. This is useful if you have a deep hierarchy of child menu items that you do not want to display in the footermap.'),
    '#size' => 3,
    '#max_length' => 3,
    '#min' => 0,
    '#default_value' => $this->configuration['footermap_recurse_limit'],
  ];
  $form['footermap_display_heading'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Enable Menu Heading'),
    '#description' => $this
      ->t('This will enable the menu-name label (e.g. Navigation, Footer) to be displayed as the heading above each menu column. This is nice if you have your menus setup in distinct blocks or controlled via the recurse-limit property above.'),
    '#options' => [
      $this
        ->t('No'),
      $this
        ->t('Yes'),
    ],
    '#default_value' => $this->configuration['footermap_display_heading'],
  ];
  $form['footermap_top_menu'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Top-level Menu'),
    '#description' => $this
      ->t('Set the plugin ID to use for the top-level menu. This may be useful if you want a footer map of menu links deep within a menu instead of pulling from each menu. The default is to use from avail-menus below.'),
    '#default_value' => $this->configuration['footermap_top_menu'],
  ];
  $form['footermap_avail_menus'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Available menus'),
    '#description' => $this
      ->t('Select which top-level menus to include in this footer site map.'),
    '#options' => $this
      ->getMenus(),
    '#default_value' => $this->configuration['footermap_avail_menus'],
  ];
  return $form;
}