You are here

abstract class GlobalVariable in More Global Variables 8

Class GlobalVariable.

@package Drupal\mgv\Plugin

Hierarchy

Expanded class hierarchy of GlobalVariable

15 files declare their use of GlobalVariable
BaseUrl.php in src/Plugin/GlobalVariable/BaseUrl.php
CurrentLangcode.php in src/Plugin/GlobalVariable/CurrentLangcode.php
CurrentLangname.php in src/Plugin/GlobalVariable/CurrentLangname.php
CurrentPath.php in src/Plugin/GlobalVariable/CurrentPath.php
CurrentPathAlias.php in src/Plugin/GlobalVariable/CurrentPathAlias.php

... See full list

1 string reference to 'GlobalVariable'
MgvPluginManager::__construct in src/MgvPluginManager.php
Constructs GlobalVariablePluginManager.

File

src/Plugin/GlobalVariable.php, line 12

Namespace

Drupal\mgv\Plugin
View source
abstract class GlobalVariable implements GlobalVariableInterface {
  use StringTranslationTrait;
  private $configurations;
  private $dependency;

  /**
   * GlobalVariable constructor.
   *
   * @param array $configurations
   *   Configuration that collected from createInstance() method.
   *
   * @see \Drupal\mgv\MgvPluginManager::createInstance()
   */
  public function __construct(array $configurations) {
    $this->configurations = $configurations;
    $this->dependency = empty($this->configurations['variableDependencies']) ? [] : $this->configurations['variableDependencies'];
  }

  /**
   * Dependency getter.
   *
   * @param string $id
   *   Name of dependency.
   *
   * @return array|mixed
   *   Value of dependent global variable.
   */
  public function getDependency($id) {
    return empty($this->dependency[$id]) ? NULL : $this->dependency[$id];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GlobalVariable::$configurations private property
GlobalVariable::$dependency private property
GlobalVariable::getDependency public function Dependency getter.
GlobalVariable::__construct public function GlobalVariable constructor.
GlobalVariableInterface::getValue public function Method that implement generating value of global variable. 15
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.