You are here

public function PathPluginBase::buildOptionsForm in Drupal 10

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

Provides the default form for setting options.

Overrides DisplayPluginInterface::buildOptionsForm

2 calls to PathPluginBase::buildOptionsForm()
Feed::buildOptionsForm in core/modules/views/src/Plugin/views/display/Feed.php
Provides the default form for setting options.
Page::buildOptionsForm in core/modules/views/src/Plugin/views/display/Page.php
Provides the default form for setting options.
3 methods override PathPluginBase::buildOptionsForm()
Feed::buildOptionsForm in core/modules/views/src/Plugin/views/display/Feed.php
Provides the default form for setting options.
Page::buildOptionsForm in core/modules/views/src/Plugin/views/display/Page.php
Provides the default form for setting options.
RestExport::buildOptionsForm in core/modules/rest/src/Plugin/views/display/RestExport.php
Provides the default form for setting options.

File

core/modules/views/src/Plugin/views/display/PathPluginBase.php, line 436

Class

PathPluginBase
The base display plugin for path/callbacks. This is used for pages and feeds.

Namespace

Drupal\views\Plugin\views\display

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  switch ($form_state
    ->get('section')) {
    case 'path':
      $form['#title'] .= $this
        ->t('The menu path or URL of this view');
      $form['path'] = [
        '#type' => 'textfield',
        '#title' => $this
          ->t('Path'),
        '#description' => $this
          ->t('This view will be displayed by visiting this path on your site. You may use "%" or named route parameters like "%node" in your URL to represent values that will be used for contextual filters: For example, "node/%node/feed" or "view_path/%". Named route parameters are required when this path matches an existing path. For example, paths such as "taxonomy/term/%taxonomy_term" or "user/%user/custom-view".'),
        '#default_value' => $this
          ->getOption('path'),
        '#field_prefix' => '<span dir="ltr">' . Url::fromRoute('<none>', [], [
          'absolute' => TRUE,
        ])
          ->toString() . '</span>&lrm;',
        '#attributes' => [
          'dir' => LanguageInterface::DIRECTION_LTR,
        ],
        // Account for the leading backslash.
        '#maxlength' => 254,
      ];
      break;
  }
}