1. 8.5.x core/lib/Drupal/Core/Entity/EntityHandlerBase.php EntityHandlerBase
  2. 8.0.x core/lib/Drupal/Core/Entity/EntityHandlerBase.php EntityHandlerBase
  3. 8.1.x core/lib/Drupal/Core/Entity/EntityHandlerBase.php EntityHandlerBase
  4. 8.2.x core/lib/Drupal/Core/Entity/EntityHandlerBase.php EntityHandlerBase
  5. 8.3.x core/lib/Drupal/Core/Entity/EntityHandlerBase.php EntityHandlerBase
  6. 8.4.x core/lib/Drupal/Core/Entity/EntityHandlerBase.php EntityHandlerBase
  7. 8.6.x core/lib/Drupal/Core/Entity/EntityHandlerBase.php EntityHandlerBase

Provides a base class for entity handlers.

Hierarchy

Expanded class hierarchy of EntityHandlerBase

Deprecated

in Drupal 8.0.x, will be removed before Drupal 9.0.0. Implement the container injection pattern of \Drupal\Core\Entity\EntityHandlerInterface::createInstance() to obtain the module handler service for your class.

Related topics

1 file declares its use of EntityHandlerBase

File

core/lib/Drupal/Core/Entity/EntityHandlerBase.php, line 19

Namespace

Drupal\Core\Entity
View source
abstract class EntityHandlerBase {
  use StringTranslationTrait;
  use DependencySerializationTrait;

  /**
   * The module handler to invoke hooks on.
   *
   * @var \Drupal\Core\Extension\ModuleHandlerInterface
   */
  protected $moduleHandler;

  /**
   * Gets the module handler.
   *
   * @return \Drupal\Core\Extension\ModuleHandlerInterface
   *   The module handler.
   */
  protected function moduleHandler() {
    if (!$this->moduleHandler) {
      $this->moduleHandler = \Drupal::moduleHandler();
    }
    return $this->moduleHandler;
  }

  /**
   * Sets the module handler for this handler.
   *
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler.
   *
   * @return $this
   */
  public function setModuleHandler(ModuleHandlerInterface $module_handler) {
    $this->moduleHandler = $module_handler;
    return $this;
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function Prevents serializing any properties.
DependencySerializationTrait::__wakeup public function
EntityHandlerBase::$moduleHandler protected property The module handler to invoke hooks on.
EntityHandlerBase::moduleHandler protected function Gets the module handler.
EntityHandlerBase::setModuleHandler public function Sets the module handler for this handler.
StringTranslationTrait::$stringTranslation protected property The string translation service.
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.
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.