You are here

public function AdvancedRouting::buildOptionsForm in Views Advanced Routing 8

Same name and namespace in other branches
  1. 2.x src/Plugin/views/display_extender/AdvancedRouting.php \Drupal\views_advanced_routing\Plugin\views\display_extender\AdvancedRouting::buildOptionsForm()

Overrides Drupal\views\Plugin\views\display_extender\DisplayExtenderPluginBase::buildOptionsForm().

Overrides DisplayExtenderPluginBase::buildOptionsForm

File

src/Plugin/views/display_extender/AdvancedRouting.php, line 89
Contains \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest.

Class

AdvancedRouting
Advanced route editor.

Namespace

Drupal\views_advanced_routing\Plugin\views\display_extender

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $section = $form_state
    ->get('section');
  if ($section == 'views_advanced_routing_route') {
    $route = $this->options['route'];
    $form['route'] = [
      '#title' => t('Route YAML'),
      '#type' => 'fieldset',
      '#tree' => TRUE,
    ];
    $form['route']['defaults'] = [
      '#type' => 'textarea',
      '#title' => t('Defaults'),
      '#default_value' => !empty($route['defaults']) ? Yaml::encode($route['defaults']) : '',
    ];
    $form['route']['requirements'] = [
      '#type' => 'textarea',
      '#title' => t('Requirements'),
      '#default_value' => !empty($route['requirements']) ? Yaml::encode($route['requirements']) : '',
    ];
    $form['route']['options'] = [
      '#type' => 'textarea',
      '#title' => t('Options'),
      '#default_value' => !empty($route['options']) ? Yaml::encode($route['options']) : '',
    ];
  }
}