ShortcutSetStorage
class ShortcutSetStorage extends ConfigEntityStorage implements ShortcutSetStorageInterface (View source)
Defines a storage for shortcut_set entities.
Traits
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Provides dependency injection friendly methods for serialization.
Constants
| MAX_ID_LENGTH |
Length limit of the configuration entity ID. Most file systems limit a file name's length to 255 characters, so ConfigBase::MAX_NAME_LENGTH restricts the full configuration object name to 250 characters (leaving 5 for the file extension). The config prefix is limited by ConfigEntityType::PREFIX_LENGTH to 83 characters, so this leaves 166 remaining characters for the configuration entity ID, with 1 additional character needed for the joining dot. |
Properties
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected array | $_serviceIds | An array of service IDs keyed by property name used for serialization. |
from DependencySerializationTrait |
| protected array | $_entityStorages | An array of entity type IDs keyed by the property name of their storages. |
from DependencySerializationTrait |
| protected ModuleHandlerInterface | $moduleHandler | The module handler. |
|
| protected string | $entityTypeId | Entity type ID for this storage. |
from EntityStorageBase |
| protected EntityTypeInterface | $entityType | Information about the entity type. |
from EntityStorageBase |
| protected string | $idKey | Name of the entity's ID field in the entity database table. |
from EntityStorageBase |
| protected | $uuidKey | {@inheritdoc} | from ConfigEntityStorage |
| protected string | $langcodeKey | The name of the entity langcode property. |
from EntityStorageBase |
| protected UuidInterface | $uuidService | The UUID service. |
from EntityStorageBase |
| protected MemoryCacheInterface | $memoryCache | The memory cache. |
from EntityStorageBase |
| protected string | $memoryCacheTag | The memory cache cache tag. |
from EntityStorageBase |
| protected ConfigFactoryInterface | $configFactory | The config factory service. |
from ConfigEntityStorage |
| protected StorageInterface | $configStorage | The config storage service. |
from ConfigEntityStorage |
| protected LanguageManagerInterface | $languageManager | The language manager. |
from ConfigEntityStorage |
| protected bool | $overrideFree | Determines if the underlying configuration is retrieved override free. |
from ConfigEntityStorage |
| protected Connection | $connection | The database connection. |
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 ShortcutSetStorageController object.
Retrieves the class name used to create the entity.
Warns subclasses not to directly access the deprecated entityClass property.
Warns subclasses not to directly set the deprecated entityClass property.
Builds the cache ID for the passed in entity ID.
Loads an unchanged entity from the database.
Gets entities from the static cache.
Constructs a new entity object, without permanently saving it.
Performs storage-specific creation of entities.
Loads one or more entities.
Performs storage-specific loading of entities.
Gathers entities from a 'preload' step.
Maps from storage records to entity objects.
Load entities by their property values.
Gets an entity query instance.
Gets an aggregated query instance.
Gets the name of the service for the query for this entity storage.
Indexes the given array of entities by their class name and ID.
Instantiates a new instance of this entity handler.
Load a specific entity revision.
Returns the prefix used to create the configuration name.
Extracts the configuration entity ID from the full configuration name.
Creates entities upon synchronizing configuration changes.
Updates entities upon synchronizing configuration changes.
Delete entities upon synchronizing configuration changes.
Renames entities upon synchronizing configuration changes.
Creates a configuration entity from storage values.
Helps create a configuration entity from storage values.
Updates a configuration entity from storage values.
Loads one entity in their original form without overrides.
Loads one or more entities in their original form without overrides.
Assigns a user to a particular shortcut set.
Unassigns a user from any shortcut set they may have been assigned to.
Get the number of users who have this set assigned to them.
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.
__sleep()
{@inheritdoc}
__wakeup()
{@inheritdoc}
protected ModuleHandlerInterface
moduleHandler()
Gets the module handler.
$this
setModuleHandler(ModuleHandlerInterface $module_handler)
Sets the module handler for this handler.
__construct(EntityTypeInterface $entity_info, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache, Connection $connection)
Constructs a ShortcutSetStorageController object.
string
getEntityClass(string|null $bundle = NULL)
Retrieves the class name used to create the entity.
__get(string $name)
Warns subclasses not to directly access the deprecated entityClass property.
void
__set(string $name, mixed $value)
Warns subclasses not to directly set the deprecated entityClass property.
string
getEntityTypeId()
Gets the entity type ID.
EntityTypeInterface
getEntityType()
Gets the entity type definition.
protected string
buildCacheId(int $id)
Builds the cache ID for the passed in entity ID.
EntityInterface|null
loadUnchanged(mixed $id)
Loads an unchanged entity from the database.
resetCache(array $ids = NULL)
Resets the internal entity cache.
protected EntityInterface[]
getFromStaticCache(array $ids)
Gets entities from the static cache.
protected
setStaticCache(array $entities)
Stores entities in the static entity cache.
protected
invokeHook(string $hook, EntityInterface $entity)
Invokes a hook on behalf of the entity.
EntityInterface
create(array $values = [])
Constructs a new entity object, without permanently saving it.
protected EntityInterface
doCreate(array $values)
Performs storage-specific creation of entities.
EntityInterface|null
load(mixed $id)
Loads one entity.
EntityInterface[]
loadMultiple(array $ids = NULL)
Loads one or more entities.
protected EntityInterface[]
doLoadMultiple(array $ids = NULL)
Performs storage-specific loading of entities.
Override this method to add custom functionality directly after loading. This is always called, while self::postLoad() is only called when there are actual results.
protected EntityInterface[]
preLoad(array $ids = NULL)
Gathers entities from a 'preload' step.
protected
postLoad(array $entities)
Attaches data to entities upon loading.
If there are multiple bundle classes involved, each one gets a sub array with only the entities of the same bundle. If there's only a single bundle, the entity's postLoad() method will get a copy of the original $entities array.
protected EntityInterface[]
mapFromStorageRecords(array $records)
Maps from storage records to entity objects.
protected bool
has(int|string $id, EntityInterface $entity)
Determines if this entity already exists in storage.
delete(array $entities)
Deletes permanently saved entities.
protected
doDelete(EntityInterface[] $entities)
Performs storage-specific entity deletion.
SAVED_NEW
save(EntityInterface $entity)
Implements Drupal\Core\Entity\EntityStorageInterface::save().
protected int|string
doPreSave(EntityInterface $entity)
Performs presave entity processing.
protected bool|int
doSave(int|string $id, EntityInterface $entity)
Performs storage-specific saving of the entity.
protected
doPostSave(EntityInterface $entity, bool $update)
Performs post save entity processing.
restore(EntityInterface $entity)
Restores a previously saved entity.
Note that the entity is assumed to be in a valid state for the storage, so the restore process does not invoke any hooks, nor does it perform any pre or post-save operations.
protected
buildPropertyQuery(QueryInterface $entity_query, array $values)
Builds an entity query.
EntityInterface[]
loadByProperties(array $values = [])
Load entities by their property values.
bool
hasData()
Determines if the storage contains any data.
QueryInterface
getQuery(string $conjunction = 'AND')
Gets an entity query instance.
QueryAggregateInterface
getAggregateQuery(string $conjunction = 'AND')
Gets an aggregated query instance.
protected string
getQueryServiceName()
Gets the name of the service for the query for this entity storage.
protected array
getEntitiesByClass(array $entities)
Indexes the given array of entities by their class name and ID.
static EntityHandlerInterface
createInstance(ContainerInterface $container, EntityTypeInterface $entity_info)
Instantiates a new instance of this entity handler.
This is a factory method that returns a new instance of this object. The factory should pass any needed dependencies into the constructor of this object, but not the container itself. Every call to this method must return a new instance of this object; that is, it may not implement a singleton.
EntityInterface|null
loadRevision(int|string $revision_id)
Load a specific entity revision.
deleteRevision(int $revision_id)
Delete a specific entity revision.
A revision can only be deleted if it's not the currently active one.
protected string
getPrefix()
Returns the prefix used to create the configuration name.
The prefix consists of the config prefix from the entity type plus a dot for separating from the ID.
static string
getIDFromConfigName(string $config_name, string $config_prefix)
Extracts the configuration entity ID from the full configuration name.
protected array
mapToStorageRecord(EntityInterface $entity)
Maps from an entity object to the storage record.
importCreate(string $name, Config $new_config, Config $old_config)
Creates entities upon synchronizing configuration changes.
importUpdate(string $name, Config $new_config, Config $old_config)
Updates entities upon synchronizing configuration changes.
importDelete(string $name, Config $new_config, Config $old_config)
Delete entities upon synchronizing configuration changes.
importRename(string $old_name, Config $new_config, Config $old_config)
Renames entities upon synchronizing configuration changes.
ConfigEntityInterface
createFromStorageRecord(array $values)
Creates a configuration entity from storage values.
Allows the configuration entity storage to massage storage values before creating an entity.
protected ConfigEntityInterface
_doCreateFromStorageRecord(array $values, bool $is_syncing = FALSE)
Helps create a configuration entity from storage values.
Allows the configuration entity storage to massage storage values before creating an entity.
ConfigEntityInterface
updateFromStorageRecord(ConfigEntityInterface $entity, array $values)
Updates a configuration entity from storage values.
Allows the configuration entity storage to massage storage values before updating an entity.
EntityInterface|null
loadOverrideFree(mixed $id)
Loads one entity in their original form without overrides.
EntityInterface[]
loadMultipleOverrideFree(array $ids = NULL)
Loads one or more entities in their original form without overrides.
deleteAssignedShortcutSets(ShortcutSetInterface $entity)
Delete shortcut sets assigned to users.
assignUser(ShortcutSetInterface $shortcut_set, $account)
Assigns a user to a particular shortcut set.
bool
unassignUser($account)
Unassigns a user from any shortcut set they may have been assigned to.
The user will go back to using whatever default set applies.
string
getAssignedToUser(User $account)
Get the name of the set assigned to this user.
int
countAssignedUsers(ShortcutSetInterface $shortcut_set)
Get the number of users who have this set assigned to them.
ShortcutSetInterface
getDefaultSet(AccountInterface $account)
Gets the default shortcut set for a given user account.