Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Raw.php

function Raw::getArgument

Overrides ArgumentDefaultPluginBase::getArgument

File

core/modules/views/src/Plugin/views/argument_default/Raw.php, line 110

Class

Raw
Default argument plugin to use the raw value from the URL.

Namespace

Drupal\views\Plugin\views\argument_default

Code

public function getArgument() {
    // Don't trim the leading slash since getAliasByPath() requires it.
    $path = rtrim($this->currentPath
        ->getPath($this->view
        ->getRequest()), '/');
    if ($this->options['use_alias']) {
        $path = $this->aliasManager
            ->getAliasByPath($path);
    }
    $args = explode('/', $path);
    // Drop the empty first element created by the leading slash since the path
    // component index doesn't take it into account.
    array_shift($args);
    if (isset($args[$this->options['index']])) {
        return $args[$this->options['index']];
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal