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

Wrapper methods for classes that needs typed data manager object.

Hierarchy

3 files declare their use of TypedDataTrait
Context.php in core/lib/Drupal/Core/Plugin/Context/Context.php
ContextAwarePluginBase.php in core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php
ContextDefinition.php in core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php

File

core/lib/Drupal/Core/TypedData/TypedDataTrait.php, line 8

Namespace

Drupal\Core\TypedData
View source
trait TypedDataTrait {

  /**
   * The typed data manager used for creating the data types.
   *
   * @var \Drupal\Core\TypedData\TypedDataManagerInterface
   */
  protected $typedDataManager;

  /**
   * Sets the typed data manager.
   *
   * @param \Drupal\Core\TypedData\TypedDataManagerInterface $typed_data_manager
   *   The typed data manager.
   *
   * @return $this
   */
  public function setTypedDataManager(TypedDataManagerInterface $typed_data_manager) {
    $this->typedDataManager = $typed_data_manager;
    return $this;
  }

  /**
   * Gets the typed data manager.
   *
   * @return \Drupal\Core\TypedData\TypedDataManagerInterface
   *   The typed data manager.
   */
  public function getTypedDataManager() {
    if (empty($this->typedDataManager)) {
      $this->typedDataManager = \Drupal::typedDataManager();
    }
    return $this->typedDataManager;
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
TypedDataTrait::$typedDataManager protected property The typed data manager used for creating the data types.
TypedDataTrait::getTypedDataManager public function Gets the typed data manager.
TypedDataTrait::setTypedDataManager public function Sets the typed data manager.