You are here

public function Element::getContext in Express 8

Retrieves a context value from the #context element property, 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/Element.php, line 325
Contains \Drupal\bootstrap\Utility\Element.

Class

Element
Provides helper methods for Drupal render elements.

Namespace

Drupal\bootstrap\Utility

Code

public function &getContext($name, $default = NULL) {
  $context =& $this
    ->getProperty('context', []);
  if (!isset($context[$name])) {
    $context[$name] = $default;
  }
  return $context[$name];
}