You are here

public function AbstractEventVariables::get in Hook Event Dispatcher 8

Get a variable with a given name, return default if it does not exist.

Parameters

string $name: Variable name.

mixed|null $default: Default value.

Return value

mixed Value for variable BY VALUE.

2 calls to AbstractEventVariables::get()
AbstractEntityEventVariables::getEntityType in src/Event/Preprocess/Variables/AbstractEntityEventVariables.php
Get the Entity type.
AbstractEntityEventVariables::getViewMode in src/Event/Preprocess/Variables/AbstractEntityEventVariables.php
Get the view mode.
1 method overrides AbstractEventVariables::get()
PageEventVariables::get in src/Event/Preprocess/Variables/PageEventVariables.php
Get the template var.

File

src/Event/Preprocess/Variables/AbstractEventVariables.php, line 40

Class

AbstractEventVariables
Class AbstractEventVariables.

Namespace

Drupal\hook_event_dispatcher\Event\Preprocess\Variables

Code

public function get($name, $default = NULL) {
  return \array_key_exists($name, $this->variables) ? $this->variables[$name] : $default;
}