function ArgumentPluginBase::preRenderMoveArgumentOptions

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php \Drupal\views\Plugin\views\argument\ArgumentPluginBase::preRenderMoveArgumentOptions()
  2. 8.9.x core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php \Drupal\views\Plugin\views\argument\ArgumentPluginBase::preRenderMoveArgumentOptions()
  3. 10 core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php \Drupal\views\Plugin\views\argument\ArgumentPluginBase::preRenderMoveArgumentOptions()

Moves argument options into their place.

When configuring the default argument behavior, almost each of the radio buttons has its own fieldset shown below it when the radio button is clicked. That fieldset is created through a custom form process callback. Each element that has #argument_option defined and pointing to a default behavior gets moved to the appropriate fieldset. So if #argument_option is specified as 'default', the element is moved to the 'default_options' fieldset.

File

core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php, line 1246

Class

ArgumentPluginBase
Base class for argument (contextual filter) handler plugins.

Namespace

Drupal\views\Plugin\views\argument

Code

public static function preRenderMoveArgumentOptions($form) {
    foreach (Element::children($form) as $key) {
        $element = $form[$key];
        if (!empty($element['#argument_option'])) {
            $container_name = $element['#argument_option'] . '_options';
            if (isset($form['no_argument']['default_action'][$container_name])) {
                $form['no_argument']['default_action'][$container_name][$key] = $element;
            }
            // Remove the original element this duplicates.
            unset($form[$key]);
        }
    }
    return $form;
}

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