EntityOperations
class EntityOperations implements ContainerInjectionInterface (View source)
| internal |
Defines a class for reacting to entity events.
Traits
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Properties
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager service. |
|
| protected WorkspaceManagerInterface | $workspaceManager | The workspace manager service. |
|
| protected WorkspaceAssociationInterface | $workspaceAssociation | The workspace association service. |
Methods
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 EntityOperations instance.
Instantiates a new instance of this class.
Acts on entity IDs before they are loaded.
Alters entity forms to disallow concurrent editing in multiple workspaces.
Entity builder that marks all supported entities as pending revisions.
Determines whether we need to react on pre-save or pre-delete operations.
Details
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(EntityTypeManagerInterface $entity_type_manager, WorkspaceManagerInterface $workspace_manager, WorkspaceAssociationInterface $workspace_association)
Constructs a new EntityOperations instance.
static
create(ContainerInterface $container)
Instantiates a new instance of this class.
This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.
entityPreload(array $ids, $entity_type_id)
Acts on entity IDs before they are loaded.
entityPresave(EntityInterface $entity)
Acts on an entity before it is created or updated.
entityInsert(EntityInterface $entity)
Responds to the creation of a new entity.
entityUpdate(EntityInterface $entity)
Responds to updates to an entity.
entityPredelete(EntityInterface $entity)
Acts on an entity before it is deleted.
entityFormAlter(array $form, FormStateInterface $form_state, string $form_id)
Alters entity forms to disallow concurrent editing in multiple workspaces.
static
entityFormEntityBuild($entity_type_id, RevisionableInterface $entity, $form, FormStateInterface $form_state)
Entity builder that marks all supported entities as pending revisions.
protected bool
shouldSkipPreOperations(EntityTypeInterface $entity_type)
Determines whether we need to react on pre-save or pre-delete operations.