public function Block::buildOptionsForm

Provide the default form for setting options.

Overrides DisplayPluginBase::buildOptionsForm

File

drupal/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php, line 153
Definition of Drupal\views\Plugin\views\display\Block. Definition of Drupal\block\Plugin\views\display\Block.

Class

Block
The plugin that handles a block.

Namespace

Drupal\block\Plugin\views\display

Code

public function buildOptionsForm(&$form, &$form_state) {
  parent::buildOptionsForm($form, $form_state);
  switch ($form_state['section']) {
    case 'block_description':
      $form['#title'] .= t('Block admin description');
      $form['block_description'] = array(
        '#type' => 'textfield',
        '#description' => t('This will appear as the name of this block in administer >> structure >> blocks.'),
        '#default_value' => $this
          ->getOption('block_description'),
      );
      break;
    case 'block_caching':
      $form['#title'] .= t('Block caching type');
      $form['block_caching'] = array(
        '#type' => 'radios',
        '#description' => t("This sets the default status for Drupal's built-in block caching method; this requires that caching be turned on in block administration, and be careful because you have little control over when this cache is flushed."),
        '#options' => $this
          ->blockCachingModes(),
        '#default_value' => $this
          ->getCacheType(),
      );
      break;
    case 'exposed_form_options':
      $this->view
        ->initHandlers();
      if (!$this
        ->usesExposed() && parent::usesExposed()) {
        $form['exposed_form_options']['warning'] = array(
          '#weight' => -10,
          '#markup' => '<div class="messages warning">' . t('Exposed filters in block displays require "Use AJAX" to be set to work correctly.') . '</div>',
        );
      }
  }
}