You are here

public function CurrentPath::getValue in More Global Variables 8

Method that implement generating value of global variable.

Return value

mixed Return value of declared variable.

Overrides GlobalVariableInterface::getValue

File

src/Plugin/GlobalVariable/CurrentPath.php, line 21

Class

CurrentPath
Class CurrentPath.

Namespace

Drupal\mgv\Plugin\GlobalVariable

Code

public function getValue() {

  // Print the current path. This could be useful if you want to do a redirect
  // after a form is submitted, e.g. ?destination={{ current_path }}.
  return \Drupal::service('path.current')
    ->getPath();
}