class ImageStyle in Drupal 8
Same name and namespace in other branches
- 9 core/modules/image/src/Entity/ImageStyle.php \Drupal\image\Entity\ImageStyle
Defines an image style configuration entity.
Plugin annotation
@ConfigEntityType(
id = "image_style",
label = @Translation("Image style"),
label_collection = @Translation("Image styles"),
label_singular = @Translation("image style"),
label_plural = @Translation("image styles"),
label_count = @PluralTranslation(
singular = "@count image style",
plural = "@count image styles",
),
handlers = {
"form" = {
"add" = "Drupal\image\Form\ImageStyleAddForm",
"edit" = "Drupal\image\Form\ImageStyleEditForm",
"delete" = "Drupal\image\Form\ImageStyleDeleteForm",
"flush" = "Drupal\image\Form\ImageStyleFlushForm"
},
"list_builder" = "Drupal\image\ImageStyleListBuilder",
"storage" = "Drupal\image\ImageStyleStorage",
},
admin_permission = "administer image styles",
config_prefix = "style",
entity_keys = {
"id" = "name",
"label" = "label"
},
links = {
"flush-form" = "/admin/config/media/image-styles/manage/{image_style}/flush",
"edit-form" = "/admin/config/media/image-styles/manage/{image_style}",
"delete-form" = "/admin/config/media/image-styles/manage/{image_style}/delete",
"collection" = "/admin/config/media/image-styles",
},
config_export = {
"name",
"label",
"effects",
}
)
Hierarchy
- class \Drupal\Core\Entity\EntityBase implements EntityInterface uses RefinableCacheableDependencyTrait, DependencySerializationTrait
- class \Drupal\Core\Config\Entity\ConfigEntityBase implements ConfigEntityInterface uses SynchronizableEntityTrait, PluginDependencyTrait
- class \Drupal\image\Entity\ImageStyle implements EntityWithPluginCollectionInterface, ImageStyleInterface
- class \Drupal\Core\Config\Entity\ConfigEntityBase implements ConfigEntityInterface uses SynchronizableEntityTrait, PluginDependencyTrait
Expanded class hierarchy of ImageStyle
34 files declare their use of ImageStyle
- ConfigEntityImportTest.php in core/
modules/ system/ tests/ src/ Kernel/ Entity/ ConfigEntityImportTest.php - FileMoveTest.php in core/
modules/ image/ tests/ src/ Functional/ FileMoveTest.php - image.module in core/
modules/ image/ image.module - Exposes global functionality for creating image styles.
- ImageAdminStylesTest.php in core/
modules/ image/ tests/ src/ Functional/ ImageAdminStylesTest.php - ImageAdminStylesTest.php in core/
modules/ image/ tests/ src/ FunctionalJavascript/ ImageAdminStylesTest.php
File
- core/
modules/ image/ src/ Entity/ ImageStyle.php, line 67
Namespace
Drupal\image\EntityView source
class ImageStyle extends ConfigEntityBase implements ImageStyleInterface, EntityWithPluginCollectionInterface {
/**
* The name of the image style.
*
* @var string
*/
protected $name;
/**
* The image style label.
*
* @var string
*/
protected $label;
/**
* The array of image effects for this image style.
*
* @var array
*/
protected $effects = [];
/**
* Holds the collection of image effects that are used by this image style.
*
* @var \Drupal\image\ImageEffectPluginCollection
*/
protected $effectsCollection;
/**
* {@inheritdoc}
*/
public function id() {
return $this->name;
}
/**
* {@inheritdoc}
*/
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update);
if ($update) {
if (!empty($this->original) && $this
->id() !== $this->original
->id()) {
// The old image style name needs flushing after a rename.
$this->original
->flush();
// Update field settings if necessary.
if (!$this
->isSyncing()) {
static::replaceImageStyle($this);
}
}
else {
// Flush image style when updating without changing the name.
$this
->flush();
}
}
}
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities) {
parent::postDelete($storage, $entities);
/** @var \Drupal\image\ImageStyleInterface[] $entities */
foreach ($entities as $style) {
// Flush cached media for the deleted style.
$style
->flush();
// Clear the replacement ID, if one has been previously stored.
/** @var \Drupal\image\ImageStyleStorageInterface $storage */
$storage
->clearReplacementId($style
->id());
}
}
/**
* Update field settings if the image style name is changed.
*
* @param \Drupal\image\ImageStyleInterface $style
* The image style.
*/
protected static function replaceImageStyle(ImageStyleInterface $style) {
if ($style
->id() != $style
->getOriginalId()) {
// Loop through all entity displays looking for formatters / widgets using
// the image style.
foreach (EntityViewDisplay::loadMultiple() as $display) {
foreach ($display
->getComponents() as $name => $options) {
if (isset($options['type']) && $options['type'] == 'image' && $options['settings']['image_style'] == $style
->getOriginalId()) {
$options['settings']['image_style'] = $style
->id();
$display
->setComponent($name, $options)
->save();
}
}
}
foreach (EntityFormDisplay::loadMultiple() as $display) {
foreach ($display
->getComponents() as $name => $options) {
if (isset($options['type']) && $options['type'] == 'image_image' && $options['settings']['preview_image_style'] == $style
->getOriginalId()) {
$options['settings']['preview_image_style'] = $style
->id();
$display
->setComponent($name, $options)
->save();
}
}
}
}
}
/**
* {@inheritdoc}
*/
public function buildUri($uri) {
$source_scheme = $scheme = StreamWrapperManager::getScheme($uri);
$default_scheme = $this
->fileDefaultScheme();
if ($source_scheme) {
$path = StreamWrapperManager::getTarget($uri);
// The scheme of derivative image files only needs to be computed for
// source files not stored in the default scheme.
if ($source_scheme != $default_scheme) {
$class = $this
->getStreamWrapperManager()
->getClass($source_scheme);
$is_writable = NULL;
if ($class) {
$is_writable = $class::getType() & StreamWrapperInterface::WRITE;
}
// Compute the derivative URI scheme. Derivatives created from writable
// source stream wrappers will inherit the scheme. Derivatives created
// from read-only stream wrappers will fall-back to the default scheme.
$scheme = $is_writable ? $source_scheme : $default_scheme;
}
}
else {
$path = $uri;
$source_scheme = $scheme = $default_scheme;
}
return "{$scheme}://styles/{$this->id()}/{$source_scheme}/{$this->addExtension($path)}";
}
/**
* {@inheritdoc}
*/
public function buildUrl($path, $clean_urls = NULL) {
$uri = $this
->buildUri($path);
/** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager');
// The token query is added even if the
// 'image.settings:allow_insecure_derivatives' configuration is TRUE, so
// that the emitted links remain valid if it is changed back to the default
// FALSE. However, sites which need to prevent the token query from being
// emitted at all can additionally set the
// 'image.settings:suppress_itok_output' configuration to TRUE to achieve
// that (if both are set, the security token will neither be emitted in the
// image derivative URL nor checked for in
// \Drupal\image\ImageStyleInterface::deliver()).
$token_query = [];
if (!\Drupal::config('image.settings')
->get('suppress_itok_output')) {
// The passed $path variable can be either a relative path or a full URI.
$original_uri = $stream_wrapper_manager::getScheme($path) ? $stream_wrapper_manager
->normalizeUri($path) : file_build_uri($path);
$token_query = [
IMAGE_DERIVATIVE_TOKEN => $this
->getPathToken($original_uri),
];
}
if ($clean_urls === NULL) {
// Assume clean URLs unless the request tells us otherwise.
$clean_urls = TRUE;
try {
$request = \Drupal::request();
$clean_urls = RequestHelper::isCleanUrl($request);
} catch (ServiceNotFoundException $e) {
}
}
// If not using clean URLs, the image derivative callback is only available
// with the script path. If the file does not exist, use Url::fromUri() to
// ensure that it is included. Once the file exists it's fine to fall back
// to the actual file path, this avoids bootstrapping PHP once the files are
// built.
if ($clean_urls === FALSE && $stream_wrapper_manager::getScheme($uri) == 'public' && !file_exists($uri)) {
$directory_path = $stream_wrapper_manager
->getViaUri($uri)
->getDirectoryPath();
return Url::fromUri('base:' . $directory_path . '/' . $stream_wrapper_manager::getTarget($uri), [
'absolute' => TRUE,
'query' => $token_query,
])
->toString();
}
$file_url = file_create_url($uri);
// Append the query string with the token, if necessary.
if ($token_query) {
$file_url .= (strpos($file_url, '?') !== FALSE ? '&' : '?') . UrlHelper::buildQuery($token_query);
}
return $file_url;
}
/**
* {@inheritdoc}
*/
public function flush($path = NULL) {
// A specific image path has been provided. Flush only that derivative.
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = \Drupal::service('file_system');
if (isset($path)) {
$derivative_uri = $this
->buildUri($path);
if (file_exists($derivative_uri)) {
try {
$file_system
->delete($derivative_uri);
} catch (FileException $e) {
// Ignore failed deletes.
}
}
return $this;
}
// Delete the style directory in each registered wrapper.
$wrappers = $this
->getStreamWrapperManager()
->getWrappers(StreamWrapperInterface::WRITE_VISIBLE);
foreach ($wrappers as $wrapper => $wrapper_data) {
if (file_exists($directory = $wrapper . '://styles/' . $this
->id())) {
try {
$file_system
->deleteRecursive($directory);
} catch (FileException $e) {
// Ignore failed deletes.
}
}
}
// Let other modules update as necessary on flush.
$module_handler = \Drupal::moduleHandler();
$module_handler
->invokeAll('image_style_flush', [
$this,
]);
// Clear caches so that formatters may be added for this style.
drupal_theme_rebuild();
Cache::invalidateTags($this
->getCacheTagsToInvalidate());
return $this;
}
/**
* {@inheritdoc}
*/
public function createDerivative($original_uri, $derivative_uri) {
// If the source file doesn't exist, return FALSE without creating folders.
$image = $this
->getImageFactory()
->get($original_uri);
if (!$image
->isValid()) {
return FALSE;
}
// Get the folder for the final location of this style.
$directory = \Drupal::service('file_system')
->dirname($derivative_uri);
// Build the destination folder tree if it doesn't already exist.
if (!\Drupal::service('file_system')
->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
\Drupal::logger('image')
->error('Failed to create style directory: %directory', [
'%directory' => $directory,
]);
return FALSE;
}
foreach ($this
->getEffects() as $effect) {
$effect
->applyEffect($image);
}
if (!$image
->save($derivative_uri)) {
if (file_exists($derivative_uri)) {
\Drupal::logger('image')
->error('Cached image file %destination already exists. There may be an issue with your rewrite configuration.', [
'%destination' => $derivative_uri,
]);
}
return FALSE;
}
return TRUE;
}
/**
* {@inheritdoc}
*/
public function transformDimensions(array &$dimensions, $uri) {
foreach ($this
->getEffects() as $effect) {
$effect
->transformDimensions($dimensions, $uri);
}
}
/**
* {@inheritdoc}
*/
public function getDerivativeExtension($extension) {
foreach ($this
->getEffects() as $effect) {
$extension = $effect
->getDerivativeExtension($extension);
}
return $extension;
}
/**
* {@inheritdoc}
*/
public function getPathToken($uri) {
// Return the first 8 characters.
return substr(Crypt::hmacBase64($this
->id() . ':' . $this
->addExtension($uri), $this
->getPrivateKey() . $this
->getHashSalt()), 0, 8);
}
/**
* {@inheritdoc}
*/
public function deleteImageEffect(ImageEffectInterface $effect) {
$this
->getEffects()
->removeInstanceId($effect
->getUuid());
$this
->save();
return $this;
}
/**
* {@inheritdoc}
*/
public function supportsUri($uri) {
// Only support the URI if its extension is supported by the current image
// toolkit.
return in_array(mb_strtolower(pathinfo($uri, PATHINFO_EXTENSION)), $this
->getImageFactory()
->getSupportedExtensions());
}
/**
* {@inheritdoc}
*/
public function getEffect($effect) {
return $this
->getEffects()
->get($effect);
}
/**
* {@inheritdoc}
*/
public function getEffects() {
if (!$this->effectsCollection) {
$this->effectsCollection = new ImageEffectPluginCollection($this
->getImageEffectPluginManager(), $this->effects);
$this->effectsCollection
->sort();
}
return $this->effectsCollection;
}
/**
* {@inheritdoc}
*/
public function getPluginCollections() {
return [
'effects' => $this
->getEffects(),
];
}
/**
* {@inheritdoc}
*/
public function addImageEffect(array $configuration) {
$configuration['uuid'] = $this
->uuidGenerator()
->generate();
$this
->getEffects()
->addInstanceId($configuration['uuid'], $configuration);
return $configuration['uuid'];
}
/**
* {@inheritdoc}
*/
public function getReplacementID() {
/** @var \Drupal\image\ImageStyleStorageInterface $storage */
$storage = $this
->entityTypeManager()
->getStorage($this
->getEntityTypeId());
return $storage
->getReplacementId($this
->id());
}
/**
* {@inheritdoc}
*/
public function getName() {
return $this
->get('name');
}
/**
* {@inheritdoc}
*/
public function setName($name) {
$this
->set('name', $name);
return $this;
}
/**
* Returns the image effect plugin manager.
*
* @return \Drupal\Component\Plugin\PluginManagerInterface
* The image effect plugin manager.
*/
protected function getImageEffectPluginManager() {
return \Drupal::service('plugin.manager.image.effect');
}
/**
* Returns the image factory.
*
* @return \Drupal\Core\Image\ImageFactory
* The image factory.
*/
protected function getImageFactory() {
return \Drupal::service('image.factory');
}
/**
* Gets the Drupal private key.
*
* @return string
* The Drupal private key.
*/
protected function getPrivateKey() {
return \Drupal::service('private_key')
->get();
}
/**
* Gets a salt useful for hardening against SQL injection.
*
* @return string
* A salt based on information in settings.php, not in the database.
*
* @throws \RuntimeException
*/
protected function getHashSalt() {
return Settings::getHashSalt();
}
/**
* Adds an extension to a path.
*
* If this image style changes the extension of the derivative, this method
* adds the new extension to the given path. This way we avoid filename
* clashes while still allowing us to find the source image.
*
* @param string $path
* The path to add the extension to.
*
* @return string
* The given path if this image style doesn't change its extension, or the
* path with the added extension if it does.
*/
protected function addExtension($path) {
$original_extension = pathinfo($path, PATHINFO_EXTENSION);
$extension = $this
->getDerivativeExtension($original_extension);
if ($original_extension !== $extension) {
$path .= '.' . $extension;
}
return $path;
}
/**
* Provides a wrapper for file_uri_scheme() to allow unit testing.
*
* Returns the scheme of a URI (e.g. a stream).
*
* @param string $uri
* A stream, referenced as "scheme://target" or "data:target".
*
* @return string
* A string containing the name of the scheme, or FALSE if none. For
* example, the URI "public://example.txt" would return "public".
*
* @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
* \Drupal\Core\StreamWrapper\StreamWrapperManager::getTarget() instead.
*
* @see https://www.drupal.org/node/3035273
*/
protected function fileUriScheme($uri) {
@trigger_error('fileUriTarget() is deprecated in drupal:8.8.0. It will be removed from drupal:9.0.0. See https://www.drupal.org/node/3035273', E_USER_DEPRECATED);
return StreamWrapperManager::getScheme($uri);
}
/**
* Provides a wrapper for file_uri_target() to allow unit testing.
*
* Returns the part of a URI after the schema.
*
* @param string $uri
* A stream, referenced as "scheme://target" or "data:target".
*
* @return string|bool
* A string containing the target (path), or FALSE if none.
* For example, the URI "public://sample/test.txt" would return
* "sample/test.txt".
*
* @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
* \Drupal\Core\StreamWrapper\StreamWrapperManager::getUriTarget() instead.
*
* @see https://www.drupal.org/node/3035273
*/
protected function fileUriTarget($uri) {
@trigger_error('fileUriTarget() is deprecated in drupal:8.8.0. It will be removed from drupal:9.0.0. See https://www.drupal.org/node/3035273', E_USER_DEPRECATED);
return StreamWrapperManager::getTarget($uri);
}
/**
* Provides a wrapper to allow unit testing.
*
* Gets the default file stream implementation.
*
* @return string
* 'public', 'private' or any other file scheme defined as the default.
*/
protected function fileDefaultScheme() {
return \Drupal::config('system.file')
->get('default_scheme');
}
/**
* Gets the stream wrapper manager service.
*
* @return \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
* The stream wrapper manager service
*
* @todo Properly inject this service in Drupal 9.0.x.
*/
protected function getStreamWrapperManager() {
return \Drupal::service('stream_wrapper_manager');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableDependencyTrait:: |
protected | property | Cache contexts. | |
CacheableDependencyTrait:: |
protected | property | Cache max-age. | |
CacheableDependencyTrait:: |
protected | property | Cache tags. | |
CacheableDependencyTrait:: |
protected | function | Sets cacheability; useful for value object constructors. | |
ConfigEntityBase:: |
private | property | Whether the config is being deleted by the uninstall process. | |
ConfigEntityBase:: |
protected | property | The language code of the entity's default language. | |
ConfigEntityBase:: |
protected | property | The original ID of the configuration entity. | |
ConfigEntityBase:: |
protected | property | The enabled/disabled status of the configuration entity. | 4 |
ConfigEntityBase:: |
protected | property | Third party entity settings. | |
ConfigEntityBase:: |
protected | property | Trust supplied data and not use configuration schema on save. | |
ConfigEntityBase:: |
protected | property | The UUID for this entity. | |
ConfigEntityBase:: |
protected | property | Information maintained by Drupal core about configuration. | |
ConfigEntityBase:: |
protected | function | Overrides \Drupal\Core\Entity\DependencyTrait:addDependency(). | |
ConfigEntityBase:: |
public | function |
Calculates dependencies and stores them in the dependency property. Overrides ConfigEntityInterface:: |
13 |
ConfigEntityBase:: |
public | function |
Creates a duplicate of the entity. Overrides EntityBase:: |
1 |
ConfigEntityBase:: |
public | function |
Disables the configuration entity. Overrides ConfigEntityInterface:: |
1 |
ConfigEntityBase:: |
public | function |
Enables the configuration entity. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Returns the value of a property. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Returns the cache tags that should be used to invalidate caches. Overrides EntityBase:: |
1 |
ConfigEntityBase:: |
public | function |
Gets the configuration dependency name. Overrides EntityBase:: |
|
ConfigEntityBase:: |
protected static | function | Gets the configuration manager. | |
ConfigEntityBase:: |
public | function |
Gets the configuration target identifier for the entity. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Gets the configuration dependencies. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Gets the original ID. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Gets the list of third parties that store information. Overrides ThirdPartySettingsInterface:: |
|
ConfigEntityBase:: |
public | function |
Gets the value of a third-party setting. Overrides ThirdPartySettingsInterface:: |
|
ConfigEntityBase:: |
public | function |
Gets all third-party settings of a given module. Overrides ThirdPartySettingsInterface:: |
|
ConfigEntityBase:: |
protected | function | Gets the typed config manager. | |
ConfigEntityBase:: |
public | function |
Gets whether on not the data is trusted. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
protected static | function |
Override to never invalidate the individual entities' cache tags; the
config system already invalidates them. Overrides EntityBase:: |
|
ConfigEntityBase:: |
protected | function |
Override to never invalidate the entity's cache tag; the config system
already invalidates it. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Checks whether this entity is installable. Overrides ConfigEntityInterface:: |
2 |
ConfigEntityBase:: |
public | function |
Overrides Entity::isNew(). Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Returns whether this entity is being changed during the uninstall process. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Deprecated way of generating a link to the entity. See toLink(). Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Informs the entity that entities it depends on will be deleted. Overrides ConfigEntityInterface:: |
7 |
ConfigEntityBase:: |
public static | function |
Acts on entities before they are deleted and before hooks are invoked. Overrides EntityBase:: |
8 |
ConfigEntityBase:: |
public | function |
Acts on an entity before the presave hook is invoked. Overrides EntityBase:: |
13 |
ConfigEntityBase:: |
public | function |
Saves an entity permanently. Overrides EntityBase:: |
1 |
ConfigEntityBase:: |
public | function |
Sets the value of a property. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Sets the original ID. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Sets the status of the configuration entity. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Sets the value of a third-party setting. Overrides ThirdPartySettingsInterface:: |
|
ConfigEntityBase:: |
public | function | ||
ConfigEntityBase:: |
public static | function | Helper callback for uasort() to sort configuration entities by weight and label. | 6 |
ConfigEntityBase:: |
public | function |
Returns whether the configuration entity is enabled. Overrides ConfigEntityInterface:: |
4 |
ConfigEntityBase:: |
public | function |
Gets an array of all property values. Overrides EntityBase:: |
2 |
ConfigEntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Sets that the data should be trusted. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Unsets a third-party setting. Overrides ThirdPartySettingsInterface:: |
|
ConfigEntityBase:: |
public | function |
Gets the public URL for this entity. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Constructs an Entity object. Overrides EntityBase:: |
10 |
ConfigEntityBase:: |
public | function |
Overrides EntityBase:: |
4 |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | Aliased as: traitSleep | 1 |
DependencySerializationTrait:: |
public | function | 2 | |
DependencyTrait:: |
protected | property | The object's dependencies. | |
DependencyTrait:: |
protected | function | Adds multiple dependencies. | |
DependencyTrait:: |
protected | function | Adds a dependency. Aliased as: addDependencyTrait | |
EntityBase:: |
protected | property | Boolean indicating whether the entity should be forced to be new. | |
EntityBase:: |
protected | property | The entity type. | |
EntityBase:: |
protected | property | A typed data object wrapping this entity. | |
EntityBase:: |
public | function |
Checks data value access. Overrides AccessibleInterface:: |
1 |
EntityBase:: |
public | function |
Gets the bundle of the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
public static | function |
Constructs a new entity object, without permanently saving it. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Deletes an entity permanently. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Enforces an entity to be new. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | Gets the entity manager. | |
EntityBase:: |
protected | function | Gets the entity type bundle info service. | |
EntityBase:: |
protected | function | Gets the entity type manager. | |
EntityBase:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
Gets the key that is used to store configuration dependencies. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the entity type definition. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the ID of the type of the entity. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | The list cache tags to invalidate for this entity. | |
EntityBase:: |
public | function |
Gets a typed data object for this entity object. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Indicates if a link template exists for a given key. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the label of the entity. Overrides EntityInterface:: |
6 |
EntityBase:: |
public | function |
Gets the language of the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets the language manager. | |
EntityBase:: |
protected | function | Gets an array link templates. | 1 |
EntityBase:: |
public static | function |
Loads an entity. Overrides EntityInterface:: |
|
EntityBase:: |
public static | function |
Loads one or more entities. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Acts on a created entity before hooks are invoked. Overrides EntityInterface:: |
4 |
EntityBase:: |
public static | function |
Acts on loaded entities. Overrides EntityInterface:: |
2 |
EntityBase:: |
public static | function |
Changes the values of an entity before it is created. Overrides EntityInterface:: |
5 |
EntityBase:: |
public | function |
Gets a list of entities referenced by this entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Generates the HTML for a link to this entity. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets a list of URI relationships supported by this entity. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | Gets an array of placeholders for this entity. | 2 |
EntityBase:: |
public | function |
Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets the UUID generator. | |
ImageStyle:: |
protected | property | The array of image effects for this image style. | |
ImageStyle:: |
protected | property | Holds the collection of image effects that are used by this image style. | |
ImageStyle:: |
protected | property | The image style label. | |
ImageStyle:: |
protected | property | The name of the image style. | |
ImageStyle:: |
protected | function | Adds an extension to a path. | |
ImageStyle:: |
public | function |
Saves an image effect for this style. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
public | function |
Returns the URI of this image when using this style. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
public | function |
Returns the URL of this image derivative for an original image path or URI. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
public | function |
Creates a new image derivative based on this image style. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
public | function |
Deletes an image effect from this style. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
protected | function | Provides a wrapper to allow unit testing. | |
ImageStyle:: |
protected | function | Provides a wrapper for file_uri_scheme() to allow unit testing. | |
ImageStyle:: |
protected | function | Provides a wrapper for file_uri_target() to allow unit testing. | |
ImageStyle:: |
public | function |
Flushes cached media for this style. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
public | function |
Determines the extension of the derivative without generating it. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
public | function |
Returns a specific image effect. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
public | function |
Returns the image effects for this style. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
protected | function | Gets a salt useful for hardening against SQL injection. | |
ImageStyle:: |
protected | function | Returns the image effect plugin manager. | |
ImageStyle:: |
protected | function | Returns the image factory. | |
ImageStyle:: |
public | function |
Returns the image style. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
public | function |
Generates a token to protect an image style derivative. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
public | function |
Gets the plugin collections used by this object. Overrides ObjectWithPluginCollectionInterface:: |
|
ImageStyle:: |
protected | function | Gets the Drupal private key. | |
ImageStyle:: |
public | function |
Returns the replacement ID. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
protected | function | Gets the stream wrapper manager service. | |
ImageStyle:: |
public | function |
Gets the identifier. Overrides EntityBase:: |
|
ImageStyle:: |
public static | function |
Acts on deleted entities before the delete hook is invoked. Overrides EntityBase:: |
|
ImageStyle:: |
public | function |
Acts on a saved entity before the insert or update hook is invoked. Overrides EntityBase:: |
|
ImageStyle:: |
protected static | function | Update field settings if the image style name is changed. | |
ImageStyle:: |
public | function |
Sets the name of the image style. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
public | function |
Determines if this style can be applied to a given image. Overrides ImageStyleInterface:: |
|
ImageStyle:: |
public | function |
Determines the dimensions of this image style. Overrides ImageStyleInterface:: |
|
PluginDependencyTrait:: |
protected | function | Calculates and adds dependencies of a specific plugin instance. | 1 |
PluginDependencyTrait:: |
protected | function | Calculates and returns dependencies of a specific plugin instance. | |
PluginDependencyTrait:: |
protected | function | Wraps the module handler. | 1 |
PluginDependencyTrait:: |
protected | function | Wraps the theme handler. | 1 |
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
SynchronizableEntityTrait:: |
protected | property | Whether this entity is being created, updated or deleted through a synchronization process. | |
SynchronizableEntityTrait:: |
public | function | ||
SynchronizableEntityTrait:: |
public | function |