You are here

public function MgvPluginManager::getVariables in More Global Variables 8

Returns all the variables.

Return value

array[mixed] Variables list.

Overrides MgvPluginManagerInterface::getVariables

File

src/MgvPluginManager.php, line 54

Class

MgvPluginManager
Class MgvPluginManager.

Namespace

Drupal\mgv

Code

public function getVariables() {
  if (empty($this->variables)) {
    $this->variables = [];
    $all = $this
      ->getDefinitions();
    foreach ($all as $definition_info) {

      /* @var \Drupal\mgv\Plugin\GlobalVariableInterface $variable */
      $variable = $this
        ->createInstance($definition_info['id'], $definition_info);
      $this->variables = NestedArray::mergeDeep($this->variables, $this
        ->getNamespacedValue($definition_info['id'], $variable));
    }
  }
  return $this->variables;
}