function HandlerBase::buildOptionsForm

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::buildOptionsForm()
  2. 10 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::buildOptionsForm()
  3. 11.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::buildOptionsForm()

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 option form that provides 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.
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 option form that provides 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.
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 257

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.