You are here

public function AbstractEventVariables::get in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/preprocess_event_dispatcher/src/Variables/AbstractEventVariables.php \Drupal\preprocess_event_dispatcher\Variables\AbstractEventVariables::get()

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 modules/preprocess_event_dispatcher/src/Variables/AbstractEntityEventVariables.php
Get the Entity type.
AbstractEntityEventVariables::getViewMode in modules/preprocess_event_dispatcher/src/Variables/AbstractEntityEventVariables.php
Get the view mode.
1 method overrides AbstractEventVariables::get()
PageEventVariables::get in modules/preprocess_event_dispatcher/src/Variables/PageEventVariables.php
Get the template var.

File

modules/preprocess_event_dispatcher/src/Variables/AbstractEventVariables.php, line 42

Class

AbstractEventVariables
Class AbstractEventVariables.

Namespace

Drupal\preprocess_event_dispatcher\Variables

Code

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