public function Variables::getContext in Express 8
Retrieves a context value from the variables array or its element, if any.
Parameters
string $name: The name of the context key to retrieve.
mixed $default: Optional. The default value to use if the context $name isn't set.
Return value
mixed|NULL The context value or the $default value if not set.
File
- themes/
contrib/ bootstrap/ src/ Utility/ Variables.php, line 63 - Contains \Drupal\bootstrap\Utility\Variables.
Class
- Variables
- Class to help modify template variables.
Namespace
Drupal\bootstrap\UtilityCode
public function &getContext($name, $default = NULL) {
$context =& $this
->offsetGet($this->attributePrefix . 'context', []);
if (!isset($context[$name])) {
// If there is no context on the variables array but there is an element
// present, proxy the method to the element.
if ($this->element) {
return $this->element
->getContext($name, $default);
}
$context[$name] = $default;
}
return $context[$name];
}