function Block::buildOptionsForm

Same name in other branches
  1. 4.0.x modules/ctools_views/src/Plugin/Display/Block.php \Drupal\ctools_views\Plugin\Display\Block::buildOptionsForm()

Overrides Block::buildOptionsForm

File

modules/ctools_views/src/Plugin/Display/Block.php, line 87

Class

Block
Provides a Block display plugin.

Namespace

Drupal\ctools_views\Plugin\Display

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);
    $form['allow']['#options']['offset'] = $this->t('Pager offset');
    $form['allow']['#options']['pager'] = $this->t('Pager type');
    $form['allow']['#options']['hide_fields'] = $this->t('Hide fields');
    $form['allow']['#options']['sort_fields'] = $this->t('Reorder fields');
    $form['allow']['#options']['configure_filters'] = $this->t('Configure filters');
    $form['allow']['#options']['disable_filters'] = $this->t('Disable filters');
    $form['allow']['#options']['configure_sorts'] = $this->t('Configure sorts');
    $defaults = [];
    if (!empty($form['allow']['#default_value'])) {
        $defaults = array_filter($form['allow']['#default_value']);
        if (!empty($defaults['items_per_page'])) {
            $defaults['items_per_page'] = 'items_per_page';
        }
    }
    $form['allow']['#default_value'] = $defaults;
}