You are here

public function EntitySchemaSubscriber::onEntityTypeCreate in Drupal 10

Same name in this branch
  1. 10 core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php \Drupal\workspaces\EventSubscriber\EntitySchemaSubscriber::onEntityTypeCreate()
  2. 10 core/modules/system/tests/modules/entity_test_update/src/EventSubscriber/EntitySchemaSubscriber.php \Drupal\entity_test_update\EventSubscriber\EntitySchemaSubscriber::onEntityTypeCreate()
Same name and namespace in other branches
  1. 8 core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php \Drupal\workspaces\EventSubscriber\EntitySchemaSubscriber::onEntityTypeCreate()
  2. 9 core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php \Drupal\workspaces\EventSubscriber\EntitySchemaSubscriber::onEntityTypeCreate()

Reacts to the creation of the entity type.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type being created.

Overrides EntityTypeEventSubscriberTrait::onEntityTypeCreate

1 call to EntitySchemaSubscriber::onEntityTypeCreate()
EntitySchemaSubscriber::onFieldableEntityTypeCreate in core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php
Reacts to the creation of the fieldable entity type.

File

core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php, line 70

Class

EntitySchemaSubscriber
Defines a class for listening to entity schema changes.

Namespace

Drupal\workspaces\EventSubscriber

Code

public function onEntityTypeCreate(EntityTypeInterface $entity_type) {

  // If the entity type is supported by Workspaces, add the revision metadata
  // field.
  if ($this->workspaceManager
    ->isEntityTypeSupported($entity_type)) {
    $this
      ->addRevisionMetadataField($entity_type);
  }
}