You are here

final class TemplatePreprocessDefaultVariablesAlterEvent in Hook Event Dispatcher 8

Class TemplatePreprocessDefaultVariablesAlterEvent.

Hierarchy

Expanded class hierarchy of TemplatePreprocessDefaultVariablesAlterEvent

2 files declare their use of TemplatePreprocessDefaultVariablesAlterEvent
hook_event_dispatcher.module in ./hook_event_dispatcher.module
Hook event dispatcher module.
TemplatePreprocessDefaultVariablesAlterEventTest.php in tests/src/Unit/Theme/TemplatePreprocessDefaultVariablesAlterEventTest.php

File

src/Event/Theme/TemplatePreprocessDefaultVariablesAlterEvent.php, line 12

Namespace

Drupal\hook_event_dispatcher\Event\Theme
View source
final class TemplatePreprocessDefaultVariablesAlterEvent extends Event implements EventInterface {

  /**
   * Default template variables.
   *
   * @var array
   */
  private $variables;

  /**
   * TemplatePreprocessDefaultVariablesAlterEvent constructor.
   *
   * @param array $variables
   *   The associative array of default template variables, as set up by
   *   _template_preprocess_default_variables(). Passed by reference.
   *
   * @see hook_template_preprocess_default_variables_alter()
   */
  public function __construct(array &$variables) {
    $this->variables =& $variables;
  }

  /**
   * Get the dispatcher type.
   *
   * @return string
   *   The dispatcher type.
   */
  public function getDispatcherType() {
    return HookEventDispatcherInterface::TEMPLATE_PREPROCESS_DEFAULT_VARIABLES_ALTER;
  }

  /**
   * Get the default template variables by reference.
   *
   * @return array
   *   The associative array of default template variables, as set up by
   *   _template_preprocess_default_variables(). Passed by reference.
   */
  public function &getVariables() {
    return $this->variables;
  }

  /**
   * Set the updated default template variables.
   *
   * @param array $variables
   *   The updated associative array of default template variables.
   */
  public function setVariables(array $variables) {
    $this->variables = $variables;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TemplatePreprocessDefaultVariablesAlterEvent::$variables private property Default template variables.
TemplatePreprocessDefaultVariablesAlterEvent::getDispatcherType public function Get the dispatcher type. Overrides EventInterface::getDispatcherType
TemplatePreprocessDefaultVariablesAlterEvent::getVariables public function Get the default template variables by reference.
TemplatePreprocessDefaultVariablesAlterEvent::setVariables public function Set the updated default template variables.
TemplatePreprocessDefaultVariablesAlterEvent::__construct public function TemplatePreprocessDefaultVariablesAlterEvent constructor.