You are here

public function AjaxHistory::buildOptionsForm in Views AJAX History 8

Provide a form to edit options for this plugin.

Overrides DisplayExtenderPluginBase::buildOptionsForm

File

src/Plugin/views/display_extender/AjaxHistory.php, line 25

Class

AjaxHistory
Ajax history display extender plugin.

Namespace

Drupal\views_ajax_history\Plugin\views\display_extender

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  if ($form_state
    ->get('section') == 'use_ajax') {

    // Add opportunity to enable view ajax history handler for this view.
    $form['enable_history'] = [
      '#title' => $this
        ->t('AJAX history'),
      '#type' => 'checkbox',
      '#description' => $this
        ->t('Enable Views AJAX history.'),
      '#default_value' => isset($this->options['enable_history']) ? $this->options['enable_history'] : 0,
      '#states' => [
        'visible' => [
          ':input[name="use_ajax"]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
  }
}