You are here

public function ViewsExposedFilterBlocksBlock::blockForm in Views exposed filter blocks 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/ViewsExposedFilterBlocksBlock.php, line 32

Class

ViewsExposedFilterBlocksBlock
Provides a separate views exposed filter block.

Namespace

Drupal\views_exposed_filter_blocks\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form['view_display'] = [
    '#type' => 'select',
    '#options' => Views::getViewsAsOptions(FALSE, 'enabled'),
    '#title' => $this
      ->t('View') . ' & ' . $this
      ->t('Display'),
    '#description' => nl2br($this
      ->t("Select the view and its display with the exposed filters to show in this block.\nYou should disable AJAX on the selected view and ensure the view and the filter are on the same page.\nFor view displays of type 'page' better use the view built-in functionality for exposed filters in blocks.")),
    '#default_value' => $this->configuration['view_display'],
    '#required' => TRUE,
  ];
  return $form;
}