function EntityType::get

Same name in this branch
  1. 11.x core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::get()
  2. 11.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php \Drupal\Core\Entity\Annotation\EntityType::get()
Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::get()
  2. 9 core/lib/Drupal/Core/Entity/Annotation/EntityType.php \Drupal\Core\Entity\Annotation\EntityType::get()
  3. 8.9.x core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::get()
  4. 8.9.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php \Drupal\Core\Entity\Annotation\EntityType::get()
  5. 10 core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType::get()
  6. 10 core/lib/Drupal/Core/Entity/Annotation/EntityType.php \Drupal\Core\Entity\Annotation\EntityType::get()

Overrides AttributeBase::get

File

core/lib/Drupal/Core/Entity/Attribute/EntityType.php, line 67

Class

EntityType
Defines an entity type for plugin discovery.

Namespace

Drupal\Core\Entity\Attribute

Code

public function get() : array|object {
    // Use the specified entity type class, and remove it before instantiating.
    $class = $this->entity_type_class;
    $values = array_filter(get_object_vars($this) + [
        'class' => $this->getClass(),
        'provider' => $this->getProvider(),
    ], function ($value, $key) {
        return !($value === NULL && ($key === 'deriver' || $key === 'provider' || $key == 'entity_type_class'));
    }, ARRAY_FILTER_USE_BOTH);
    return new $class($values);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.