You are here

public function HandlerBase::buildOptionsForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::buildOptionsForm()

Provide a form to edit options for this plugin.

Overrides PluginBase::buildOptionsForm

6 calls to HandlerBase::buildOptionsForm()
AreaPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/area/AreaPluginBase.php
Provide a form to edit options for this plugin.
ArgumentPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
Provide a form to edit options for this plugin.
FieldPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/field/FieldPluginBase.php
Default options form that provides the label widget that all fields should have.
FilterPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
Provide the basic form which calls through to subforms. If overridden, it is best to call through to the parent, or to at least make sure all of the functions in this form are called.
RelationshipPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php
Provide a form to edit options for this plugin.

... See full list

6 methods override HandlerBase::buildOptionsForm()
AreaPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/area/AreaPluginBase.php
Provide a form to edit options for this plugin.
ArgumentPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
Provide a form to edit options for this plugin.
FieldPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/field/FieldPluginBase.php
Default options form that provides the label widget that all fields should have.
FilterPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
Provide the basic form which calls through to subforms. If overridden, it is best to call through to the parent, or to at least make sure all of the functions in this form are called.
RelationshipPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php
Provide a form to edit options for this plugin.

... See full list

File

core/modules/views/src/Plugin/views/HandlerBase.php, line 252

Class

HandlerBase
Base class for Views handler plugins.

Namespace

Drupal\views\Plugin\views

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {

  // Some form elements belong in a fieldset for presentation, but can't
  // be moved into one because of the $form_state->getValues() hierarchy. Those
  // elements can add a #fieldset => 'fieldset_name' property, and they'll
  // be moved to their fieldset during pre_render.
  $form['#pre_render'][] = [
    static::class,
    'preRenderAddFieldsetMarkup',
  ];
  parent::buildOptionsForm($form, $form_state);
  $form['fieldsets'] = [
    '#type' => 'value',
    '#value' => [
      'more',
      'admin_label',
    ],
  ];
  $form['admin_label'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Administrative title'),
    '#weight' => 150,
  ];
  $form['admin_label']['admin_label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Administrative title'),
    '#description' => $this
      ->t('This title will be displayed on the views edit page instead of the default one. This might be useful if you have the same item twice.'),
    '#default_value' => $this->options['admin_label'],
    '#parents' => [
      'options',
      'admin_label',
    ],
  ];

  // This form is long and messy enough that the "Administrative title" option
  // belongs in "Administrative title" fieldset at the bottom of the form.
  $form['more'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('More'),
    '#weight' => 200,
    '#optional' => TRUE,
  ];

  // Allow to alter the default values brought into the form.
  // @todo Do we really want to keep this hook.
  $this
    ->getModuleHandler()
    ->alter('views_handler_options', $this->options, $this->view);
}