You are here

abstract class AbstractEntityEventVariables in Hook Event Dispatcher 8

Class EntityEventVariables.

Hierarchy

Expanded class hierarchy of AbstractEntityEventVariables

1 file declares its use of AbstractEntityEventVariables
EntityEventVariablesTest.php in tests/src/Unit/Preprocess/EntityEventVariablesTest.php

File

src/Event/Preprocess/Variables/AbstractEntityEventVariables.php, line 8

Namespace

Drupal\hook_event_dispatcher\Event\Preprocess\Variables
View source
abstract class AbstractEntityEventVariables extends AbstractEventVariables {

  /**
   * Get the Entity.
   *
   * @return \Drupal\Core\Entity\EntityInterface
   *   Entity.
   */
  public abstract function getEntity();

  /**
   * Get the Entity type.
   *
   * @return string
   *   Entity type.
   */
  public function getEntityType() {
    return $this
      ->get('theme_hook_original');
  }

  /**
   * Get the Entity bundle.
   *
   * @return string
   *   Entity bundle.
   */
  public function getEntityBundle() {
    return $this
      ->getEntity()
      ->bundle();
  }

  /**
   * Get the view mode.
   *
   * @return string
   *   View mode.
   */
  public function getViewMode() {
    return $this
      ->get('view_mode');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractEntityEventVariables::getEntity abstract public function Get the Entity. 5
AbstractEntityEventVariables::getEntityBundle public function Get the Entity bundle. 1
AbstractEntityEventVariables::getEntityType public function Get the Entity type. 1
AbstractEntityEventVariables::getViewMode public function Get the view mode. 1
AbstractEventVariables::$variables protected property Variables.
AbstractEventVariables::get public function Get a variable with a given name, return default if it does not exist. 1
AbstractEventVariables::getByReference public function Get a variable with a given name by reference. 1
AbstractEventVariables::remove public function Remove a given variable. 1
AbstractEventVariables::set public function Set a variable to a given value. 1
AbstractEventVariables::__construct public function Event Variables constructor.