EntitySchemaSubscriber
class EntitySchemaSubscriber implements EntityTypeListenerInterface, EventSubscriberInterface (View source)
Defines a class for listening to entity schema changes.
Traits
Helper methods for EntityTypeListenerInterface.
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Properties
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected EntityDefinitionUpdateManagerInterface | $entityDefinitionUpdateManager | The definition update manager. |
|
| protected EntityLastInstalledSchemaRepositoryInterface | $entityLastInstalledSchemaRepository | The last installed schema definitions. |
|
| protected WorkspaceManagerInterface | $workspaceManager | The workspace manager. |
Methods
Listener method for any entity type definition event.
Reacts to the creation of the fieldable entity type.
Reacts to the update of the entity type.
Reacts to the update of a fieldable entity type.
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
Constructs a new EntitySchemaSubscriber.
{@inheritdoc}
Adds the 'workspace' revision metadata field to an entity type.
Gets the base field definition for the 'workspace' revision metadata field.
Details
static array
getEntityTypeEvents()
Gets the subscribed events.
onEntityTypeEvent(EntityTypeEvent $event, string $event_name)
Listener method for any entity type definition event.
onEntityTypeCreate(EntityTypeInterface $entity_type)
Reacts to the creation of the entity type.
onFieldableEntityTypeCreate(EntityTypeInterface $entity_type, array $field_storage_definitions)
Reacts to the creation of the fieldable entity type.
onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original)
Reacts to the update of the entity type.
onFieldableEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original, array $field_storage_definitions, array $original_field_storage_definitions, array $sandbox = NULL)
Reacts to the update of a fieldable entity type.
onEntityTypeDelete(EntityTypeInterface $entity_type)
Reacts to the deletion of the entity type.
protected TranslatableMarkup
t(string $string, array $args = [], array $options = [])
Translates a string to the current language or to a given language.
See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.
In order for strings to be localized, make them available in one of the ways supported by the
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
getStringTranslation()
Gets the string translation service.
$this
setStringTranslation(TranslationInterface $translation)
Sets the string translation service to use.
__construct(EntityDefinitionUpdateManagerInterface $entityDefinitionUpdateManager, EntityLastInstalledSchemaRepositoryInterface $entityLastInstalledSchemaRepository, WorkspaceManagerInterface $workspace_manager)
Constructs a new EntitySchemaSubscriber.
static
getSubscribedEvents()
{@inheritdoc}
protected
addRevisionMetadataField(EntityTypeInterface $entity_type)
Adds the 'workspace' revision metadata field to an entity type.
protected BaseFieldDefinition
getWorkspaceFieldDefinition()
Gets the base field definition for the 'workspace' revision metadata field.