You are here

function BookNavigationBlock::blockForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/book/src/Plugin/Block/BookNavigationBlock.php \Drupal\book\Plugin\Block\BookNavigationBlock::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 $form The renderable form array representing the entire configuration form.

Overrides BlockBase::blockForm

File

core/modules/book/src/Plugin/Block/BookNavigationBlock.php, line 101
Contains \Drupal\book\Plugin\Block\BookNavigationBlock.

Class

BookNavigationBlock
Provides a 'Book navigation' block.

Namespace

Drupal\book\Plugin\Block

Code

function blockForm($form, FormStateInterface $form_state) {
  $options = array(
    'all pages' => $this
      ->t('Show block on all pages'),
    'book pages' => $this
      ->t('Show block only on book pages'),
  );
  $form['book_block_mode'] = array(
    '#type' => 'radios',
    '#title' => $this
      ->t('Book navigation block display'),
    '#options' => $options,
    '#default_value' => $this->configuration['block_mode'],
    '#description' => $this
      ->t("If <em>Show block on all pages</em> is selected, the block will contain the automatically generated menus for all of the site's books. If <em>Show block only on book pages</em> is selected, the block will contain only the one menu corresponding to the current page's book. In this case, if the current page is not in a book, no block will be displayed. The <em>Page specific visibility settings</em> or other visibility settings can be used in addition to selectively display this block."),
  );
  return $form;
}