class Path in Bamboo Twig 8.5
Same name and namespace in other branches
- 8.2 bamboo_twig_path/src/TwigExtension/Path.php \Drupal\bamboo_twig_path\TwigExtension\Path
- 8.3 bamboo_twig_path/src/TwigExtension/Path.php \Drupal\bamboo_twig_path\TwigExtension\Path
- 8.4 bamboo_twig_path/src/TwigExtension/Path.php \Drupal\bamboo_twig_path\TwigExtension\Path
Provides a 'Path' Twig Extensions.
Hierarchy
- class \Drupal\bamboo_twig_path\TwigExtension\Path extends \Drupal\bamboo_twig_path\TwigExtension\Twig_Extension
Expanded class hierarchy of Path
1 string reference to 'Path'
- bamboo_twig_path.services.yml in bamboo_twig_path/
bamboo_twig_path.services.yml - bamboo_twig_path/bamboo_twig_path.services.yml
1 service uses Path
File
- bamboo_twig_path/
src/ TwigExtension/ Path.php, line 10
Namespace
Drupal\bamboo_twig_path\TwigExtensionView source
class Path extends \Twig_Extension {
/**
* List of all Twig functions.
*/
public function getFunctions() {
return [
new TwigFunction('bamboo_path_system', [
$this,
'getSystemPath',
]),
];
}
/**
* Unique identifier for this Twig extension.
*/
public function getName() {
return 'bamboo_twig_path.twig.path';
}
/**
* Returns the path to a system item (module, theme, etc.).
*
* @param string $type
* The type of the item; one of 'core', 'profile', 'module', 'theme',
* or 'theme_engine'.
* @param string $name
* The name of the item for which the path is requested.
* Ignored for $type 'core'.
*
* @return string
* The path to the requested item or an empty string
* if the item is not found.
*/
public function getSystemPath($type, $name = NULL) {
return drupal_get_path($type, $name);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Path:: |
public | function | List of all Twig functions. | |
Path:: |
public | function | Unique identifier for this Twig extension. | |
Path:: |
public | function | Returns the path to a system item (module, theme, etc.). |