You are here

public function EntityHierarchyArgumentPluginBase::buildOptionsForm in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/argument/EntityHierarchyArgumentPluginBase.php \Drupal\entity_hierarchy\Plugin\views\argument\EntityHierarchyArgumentPluginBase::buildOptionsForm()

Provide a form to edit options for this plugin.

Overrides ArgumentPluginBase::buildOptionsForm

2 calls to EntityHierarchyArgumentPluginBase::buildOptionsForm()
HierarchyIsParentOfEntity::buildOptionsForm in src/Plugin/views/argument/HierarchyIsParentOfEntity.php
Provide a form to edit options for this plugin.
HierarchyIsSiblingOfEntity::buildOptionsForm in src/Plugin/views/argument/HierarchyIsSiblingOfEntity.php
Provide a form to edit options for this plugin.
2 methods override EntityHierarchyArgumentPluginBase::buildOptionsForm()
HierarchyIsParentOfEntity::buildOptionsForm in src/Plugin/views/argument/HierarchyIsParentOfEntity.php
Provide a form to edit options for this plugin.
HierarchyIsSiblingOfEntity::buildOptionsForm in src/Plugin/views/argument/HierarchyIsSiblingOfEntity.php
Provide a form to edit options for this plugin.

File

src/Plugin/views/argument/EntityHierarchyArgumentPluginBase.php, line 88

Class

EntityHierarchyArgumentPluginBase
Defines a base argument plugin.

Namespace

Drupal\entity_hierarchy\Plugin\views\argument

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $options = range(1, 50);
  $form['depth'] = [
    '#type' => 'select',
    '#empty_option' => $this
      ->t('No restriction'),
    '#empty_value' => 0,
    '#options' => array_combine($options, $options),
    '#title' => $this
      ->t('Depth'),
    '#default_value' => $this->options['depth'],
    '#description' => $this
      ->t('Filter to children that are at most this many levels deeper than their parent. E.g. for immediate children, select 1.'),
  ];
  parent::buildOptionsForm($form, $form_state);
}