class BackgroundImage in Background Image 8
Same name and namespace in other branches
- 2.x src/Entity/BackgroundImage.php \Drupal\background_image\Entity\BackgroundImage
- 2.0.x src/Entity/BackgroundImage.php \Drupal\background_image\Entity\BackgroundImage
Defines the Background Image entity.
Plugin annotation
@ContentEntityType(
id = "background_image",
label = @Translation("Background Image"),
label_collection = @Translation("Background Image"),
label_singular = @Translation("background image"),
label_plural = @Translation("background images"),
label_count = @PluralTranslation(
singular = "@count background image",
plural = "@count background images"
),
handlers = {
"access" = "Drupal\background_image\BackgroundImageAccessControlHandler",
"list_builder" = "Drupal\background_image\BackgroundImageListBuilder",
"translation" = "Drupal\content_translation\ContentTranslationHandler",
"view_builder" = "Drupal\background_image\BackgroundImageViewBuilder",
"views_data" = "Drupal\views\EntityViewsData",
"form" = {
"add" = "Drupal\background_image\Form\BackgroundImageHandlerForm",
"edit" = "Drupal\background_image\Form\BackgroundImageHandlerForm",
"delete" = "Drupal\background_image\Form\BackgroundImageDeleteForm",
},
},
admin_permission = "administer background image",
base_table = "background_image",
data_table = "background_image_field_data",
translatable = TRUE,
entity_keys = {
"id" = "bid",
"label" = "label",
"uuid" = "uuid",
"langcode" = "langcode",
},
links = {
"canonical" = "/admin/config/media/background_image/{background_image}/edit",
"edit-form" = "/admin/config/media/background_image/{background_image}/edit",
"delete-form" = "/admin/config/media/background_image/{background_image}/delete",
"collection" = "/admin/config/media/background_image"
},
)
Hierarchy
- class \Drupal\Core\Entity\EntityBase implements EntityInterface uses RefinableCacheableDependencyTrait, DependencySerializationTrait
- class \Drupal\Core\Entity\ContentEntityBase implements \Drupal\Core\Entity\IteratorAggregate, ContentEntityInterface, TranslationStatusInterface uses EntityChangesDetectionTrait, SynchronizableEntityTrait
- class \Drupal\background_image\Entity\BackgroundImage implements BackgroundImageInterface uses \Symfony\Component\DependencyInjection\ContainerAwareTrait, EntityChangedTrait, StringTranslationTrait
- class \Drupal\Core\Entity\ContentEntityBase implements \Drupal\Core\Entity\IteratorAggregate, ContentEntityInterface, TranslationStatusInterface uses EntityChangesDetectionTrait, SynchronizableEntityTrait
Expanded class hierarchy of BackgroundImage
1 file declares its use of BackgroundImage
- BackgroundImageForm.php in src/
Form/ BackgroundImageForm.php
File
- src/
Entity/ BackgroundImage.php, line 68
Namespace
Drupal\background_image\EntityView source
class BackgroundImage extends ContentEntityBase implements BackgroundImageInterface {
use ContainerAwareTrait;
use EntityChangedTrait;
use StringTranslationTrait;
/**
* @var \Drupal\background_image\BackgroundImageManagerInterface
*/
protected $backgroundImageManager;
/**
* @var string
*/
protected $cssSelector;
/**
* @var \Drupal\Core\Entity\EntityRepositoryInterface
*/
protected $entityRepository;
/**
* @var string
*/
protected $settingsHash;
/**
* @var string
*/
protected $imageHash;
/**
* @var \Drupal\background_image\BackgroundImageSettings
*/
protected $settings;
/**
* @var \Drupal\background_image\BackgroundImageInterface|null
*/
protected $parent;
/**
* {@inheritdoc}
*/
public function __sleep() {
// Don't use unset() here because the magic method
// \Drupal\Core\Entity\ContentEntityBase::__get can cause the value to be
// set as a FieldItemList object. Instead, always explicitly set to NULL.
$this->cssSelector = NULL;
$this->settingsHash = NULL;
$this->imageHash = NULL;
$this->parent = NULL;
$this->settings = NULL;
return parent::__sleep();
}
/**
* {@inheritdoc}
*/
public function associateEntity(EntityInterface $entity = NULL, $save = TRUE) {
// Immediately return if not a valid entity.
if (!$this
->getBackgroundImageManager()
->validEntity($entity)) {
return;
}
$this
->set('type', self::TYPE_ENTITY)
->set('target', $entity
->getEntityTypeId() . ':' . $entity
->uuid())
->set('label', NULL);
if ($save) {
$this
->save();
}
}
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
/** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
$fields = parent::baseFieldDefinitions($entity_type);
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Authored on'))
->setDescription(t('The time that the background image was created.'))
->setDisplayOptions('view', [
'region' => 'hidden',
]);
$fields['changed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Changed'))
->setDescription(t('The time that the background image was last edited.'))
->setDisplayOptions('view', [
'region' => 'hidden',
]);
$fields['image'] = BaseFieldDefinition::create('image')
->setLabel(t('Image'))
->setDescription(t('The background image to display.'))
->setSettings([
'file_directory' => 'background_image',
'alt_field' => 0,
'alt_field_required' => 0,
'title_field' => 0,
'title_field_required' => 0,
'max_resolution' => '',
'min_resolution' => '',
'default_image' => [
'uuid' => NULL,
'alt' => '',
'title' => '',
'width' => NULL,
'height' => NULL,
],
])
->setDisplayOptions('form', [
'type' => 'image_image',
'weight' => 1,
])
->setDisplayOptions('view', [
'label' => 'hidden',
'weight' => 0,
]);
$fields['label'] = BaseFieldDefinition::create('string')
->setLabel(t('Label'))
->setDescription(t('An administrative description to help identify this specific background image.'))
->setRequired(TRUE)
->setTranslatable(TRUE)
->setDefaultValue('');
$fields['settings'] = BaseFieldDefinition::create('map')
->setLabel(t('Settings'))
->setDescription(t('Specific settings for this background image.'))
->setTranslatable(TRUE);
$fields['type'] = BaseFieldDefinition::create('list_integer')
->setLabel(t('Type'))
->setDescription(t('Choose when this background image should be displayed.'))
->setRequired(TRUE)
->setDefaultValue(self::TYPE_GLOBAL)
->setSettings([
'allowed_values' => self::getTypes(),
]);
$fields['target'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Target'))
->setDescription(t('A target, if any.'))
->setDefaultValue('');
$fields['uid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('User'))
->setDescription(t('An entity reference to the user who created this background image.'))
->addConstraint('ReferenceAccess')
->addConstraint('ValidReference')
->setRequired(TRUE)
->setSettings([
'target_type' => 'user',
]);
return $fields;
}
/**
* {@inheritdoc}
*/
protected function getBackgroundImageManager() {
if (!isset($this->backgroundImageManager)) {
$this->backgroundImageManager = $this
->getContainer()
->get('background_image.manager');
}
return $this->backgroundImageManager;
}
/**
* {@inheritdoc}
*/
public function getBlur() {
return $this
->getSetting('blur');
}
/**
* {@inheritdoc}
*/
public function getBlurRadius() {
return $this
->getSetting('blur_radius');
}
/**
* {@inheritdoc}
*/
public function getBlurSpeed() {
return $this
->getSetting('blur_speed');
}
/**
* {@inheritdoc}
*/
public function getCacheTags() {
$tags = parent::getCacheTags();
// Make sure to get
if ($this
->hasEntityToken() && ($entity = $this
->getBackgroundImageManager()
->getEntityFromCurrentRoute())) {
$tags[] = "{$entity->getEntityTypeId()}:{$entity->id()}";
}
return $tags;
}
/**
* Retrieves the Container.
*
* @return \Symfony\Component\DependencyInjection\ContainerInterface
*/
protected function getContainer() {
if (!isset($this->container)) {
$this
->setContainer(\Drupal::getContainer());
}
return $this->container;
}
/**
* {@inheritdoc}
*/
public function getCreatedTime() {
return $this
->get('created')->value;
}
/**
* {@inheritdoc}
*/
public function getCssClass() {
if (!isset($this->cssSelector)) {
$this->cssSelector = $this
->getBackgroundImageManager()
->getBaseClass() . '--' . Html::cleanCssIdentifier($this
->getImageHash());
}
return $this->cssSelector;
}
/**
* {@inheritdoc}
*/
public function getCssUri() {
$default_scheme = file_default_scheme();
$min = $this
->getBackgroundImageManager()
->useMinifiedCssUri() ? '.min' : '';
return "{$default_scheme}://background_image/css/{$this->id()}/{$default_scheme}/{$this->getImageHash()}{$min}.css";
}
/**
* Retrieves the Entity Repository service.
*
* @return \Drupal\Core\Entity\EntityRepositoryInterface|mixed
*/
protected function getEntityRepository() {
if (!isset($this->entityRepository)) {
$this->entityRepository = $this
->getContainer()
->get('entity.repository');
}
return $this->entityRepository;
}
/**
* {@inheritdoc}
*/
public function getImageHash() {
if (!isset($this->imageHash)) {
$image = $this
->getImageFile();
$data = [
'preload.background_color' => $this
->getSetting('preload.background_color'),
'file' => $image ? $image
->getFileUri() : '',
];
$this->imageHash = Crypt::hashBase64(serialize($data));
}
return $this->imageHash;
}
/**
* {@inheritdoc}
*/
public function getImageFile($parents = TRUE) {
$file = $this
->get('image')->entity;
if (!$file && $parents && ($parent = $this
->getParent())) {
$file = $parent
->getImageFile($parents);
}
return $file;
}
/**
* {@inheritdoc}
*/
public function getImageUrl($styleName = NULL, array $options = [], $parents = TRUE) {
if ($styleName === '_empty image_') {
// The smallest data URI for a 1px square transparent GIF image.
// http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever
return 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
}
$fileUri = $this
->getImageFile($parents)
->getFileUri();
if ($styleName && ($imageStyle = ImageStyle::load($styleName)) && $imageStyle instanceof ImageStyle) {
$uri = $imageStyle
->buildUrl($fileUri);
}
else {
$uri = file_create_url($fileUri);
}
$options += [
'absolute' => TRUE,
];
return Url::fromUri($uri, $options)
->toString();
}
/**
* {@inheritdoc}
*/
public function getParent() {
if (!isset($this->parent)) {
$this->parent = FALSE;
if (($target_entity = $this
->getTargetEntity()) && ($this->parent = $this
->getBackgroundImageManager()
->getEntityBundleBackgroundImage($target_entity))) {
return $this->parent;
}
else {
if ($this
->getType() !== self::TYPE_GLOBAL) {
$this->parent = $this
->getBackgroundImageManager()
->getGlobalBackgroundImage() ?: FALSE;
}
}
}
return $this->parent;
}
/**
* {@inheritdoc}
*/
public function getOwner() {
return $this
->get('uid')->entity;
}
/**
* {@inheritdoc}
*/
public function getOwnerId() {
return $this
->get('uid')->target_id;
}
/**
* {@inheritdoc}
*/
public function getSetting($name, $default = NULL) {
$value = $this
->getSettings()
->get($name);
return isset($value) ? $value : $default;
}
/**
* {@inheritdoc}
*/
public function getSettings() {
// In some cases (likely due to database serialization), the settings
// property isn't a properly constructed BackgroundImageSettings object.
// Instead of checking if the property is set, validate with instanceof.
// @see https://www.drupal.org/project/background_image/issues/3103708
// @see https://www.drupal.org/project/background_image/issues/2993568
if (!$this->settings instanceof BackgroundImageSettings) {
$settings = $this
->get('settings')
->first();
$parent = $this
->getParent();
$this->settings = new BackgroundImageSettings();
$this->settings
->initWithData($parent ? $parent
->getSettings()
->get() : $this
->getBackgroundImageManager()
->getDefaultSettings());
$this->settings
->merge($settings ? $settings
->getValue() : []);
}
return $this->settings;
}
/**
* {@inheritdoc}
*/
public function getSettingsHash($name = NULL) {
if (!isset($this->settingsHash)) {
$data = [];
if (isset($name)) {
$data[$name] = $this
->getSetting($name);
}
else {
$data['settings'] = $this
->getSettings()
->get();
}
// Add entity specific target.
if ((!isset($name) || $name === 'text' || $name === 'text.value') && $this
->hasEntityToken() && ($entity = $this
->getBackgroundImageManager()
->getEntityFromCurrentRoute())) {
$data['entity'] = $entity;
}
$serialized = serialize($data);
$this->settingsHash = Crypt::hashBase64($serialized);
}
return $this->settingsHash;
}
/**
* {@inheritdoc}
*/
public function getTarget($explode = FALSE) {
$target = $this
->get('target')->value;
return $target && $explode ? explode(':', $target) : $target;
}
/**
* {@inheritdoc}
*/
public function getTargetEntity($type = NULL, $target = NULL, $langcode = NULL, array $context = []) {
if (!isset($type)) {
$type = $this
->getType();
}
if (!isset($target)) {
$target = $this
->getTarget();
}
$entity = NULL;
if ($type === self::TYPE_ENTITY && isset($target)) {
list($entity_type, $entity_id) = explode(':', $target);
if (isset($entity_type) && isset($entity_id)) {
$entity = $this
->getEntityRepository()
->loadEntityByUuid($entity_type, $entity_id);
}
}
// Load entity with translation context.
if ($entity instanceof EntityInterface) {
return $this
->getEntityRepository()
->getTranslationFromContext($entity, $langcode ?: $this
->getLanguageCode(), $context);
}
return $entity;
}
/**
* Returns the currently set langcode for the entity.
*
* @todo Remove if https://www.drupal.org/project/drupal/issues/2303877 lands.
*
* @return string
* The currently set langcode.
*/
public function getLanguageCode() {
if ($this->activeLangcode !== LanguageInterface::LANGCODE_DEFAULT) {
return $this->activeLangcode;
}
return $this->defaultLangcode;
}
/**
* {@inheritdoc}
*/
public function getTargetEntityBundle($type = NULL, $target = NULL) {
if (!isset($type)) {
$type = $this
->getType();
}
if (!isset($target)) {
$target = $this
->getTarget();
}
$entity = NULL;
if ($type === self::TYPE_ENTITY_BUNDLE && $target) {
list($entity_type_id, $entity_bundle) = explode(':', $target);
if (isset($entity_type_id) && isset($entity_bundle) && ($entity_type = $this
->entityTypeManager()
->getDefinition($entity_type_id))) {
if ($bundle_entity_type = $entity_type
->getBundleEntityType()) {
$entity = $this
->entityTypeManager()
->getStorage($bundle_entity_type)
->load($entity_bundle);
}
else {
$entity = $entity_type;
}
}
}
return $entity;
}
/**
* {@inheritdoc}
*/
public function getTargetView($type = NULL, $target = NULL) {
if (!isset($type)) {
$type = $this
->getType();
}
if (!isset($target)) {
$target = $this
->getTarget();
}
/** @var \Drupal\views\ViewEntityInterface $view */
$view = NULL;
if ($type === self::TYPE_VIEW) {
list($view_id, $display_id) = explode(':', $target);
if (isset($view_id) && isset($display_id) && ($view = $this
->entityTypeManager()
->getStorage('view')
->load($view_id))) {
$view_executable = $view
->getExecutable();
$view_executable
->setDisplay($display_id);
if (!$this
->getBackgroundImageManager()
->validView($view)) {
$view = NULL;
}
}
}
return $view;
}
/**
* {@inheritdoc}
*/
public function getType() {
return (int) $this
->get('type')->value;
}
/**
* {@inheritdoc}
*/
public function getTypeLabel($link = FALSE) {
if (!isset($type)) {
$type = $this
->getType();
}
$types = self::getTypes();
if (!isset($types[$type])) {
return $this
->t('Unknown');
}
if ($label = $this
->label($link)) {
if ($type === self::TYPE_ENTITY || $type === self::TYPE_ENTITY_BUNDLE || $type === self::TYPE_VIEW) {
return $label;
}
return new FormattableMarkup('@type: @label', [
'@type' => $types[$type],
'@label' => $label,
]);
}
return $types[$type];
}
/**
* {@inheritdoc}
*/
public static function getTypes() {
return [
self::TYPE_GLOBAL => t('Global'),
self::TYPE_ENTITY => t('Entity'),
self::TYPE_ENTITY_BUNDLE => t('Entity Bundle'),
// @todo Re-enable once support has been properly done.
// self::TYPE_PATH => t('Path'),
// self::TYPE_ROUTE => t('Route'),
self::TYPE_VIEW => t('View'),
];
}
/**
* {@inheritdoc}
*/
public function getText() {
return $this
->getSetting('text.value');
}
/**
* {@inheritdoc}
*/
public function hasEntityToken($entity_type = NULL, $property = NULL) {
$entity_type = isset($entity_type) ? (array) $entity_type : '[^:]+';
if (is_array($entity_type)) {
$types = [];
foreach ($entity_type as $type) {
$types[] = preg_quote($type);
}
$entity_type = '(' . implode('|', $types) . ')';
}
$property = isset($property) ? (array) $property : '[^\\]]+';
if (is_array($property)) {
$properties = [];
foreach ($property as $value) {
$properties[] = preg_quote($value);
}
$property = '(' . implode('|', $properties) . ')';
}
$text = $this
->getSetting('text.value', '');
$matched = !!preg_match_all("/\\[{$entity_type}:{$property}\\]/", $text);
return $matched;
}
/**
* {@inheritdoc}
*/
public function label($link = FALSE) {
if ($entity = $this
->getTargetEntity()) {
return $this
->t('%entity_type (@entity_id): @entity_label', [
'%entity_type' => $this
->getBackgroundImageManager()
->getEntityBundleLabel($entity) ?: $entity
->getEntityType()
->getLabel(),
'@entity_label' => $link ? $entity
->toLink()
->toString() : $entity
->label(),
'@entity_id' => $entity
->id(),
]);
}
else {
if ($entity_bundle = $this
->getTargetEntityBundle()) {
if ($entity_bundle instanceof EntityInterface) {
return $this
->t('%entity_type (@entity_id): @entity_label', [
'%entity_type' => $entity_bundle
->getEntityType()
->getLabel(),
'@entity_label' => $link && $entity_bundle
->hasLinkTemplate('edit-form') ? $entity_bundle
->toLink(NULL, 'edit-form')
->toString() : $entity_bundle
->label(),
'@entity_id' => $entity_bundle
->id(),
]);
}
else {
if ($entity_bundle instanceof EntityTypeInterface) {
return $this
->t('%entity_type (@entity_id)', [
'%entity_type' => $entity_bundle
->getLabel(),
'@entity_id' => $entity_bundle
->id(),
]);
}
}
}
else {
if ($view = $this
->getTargetView()) {
$executable = $view
->getExecutable();
$display = $executable
->getDisplay();
$path = FALSE;
if ($display
->hasPath()) {
$path = '/' . $display
->getPath();
if ($view
->status() && strpos($path, '%') === FALSE) {
$path = \Drupal::l($path, Url::fromUserInput($path));
}
}
return $this
->t('View (@entity_id): @entity_label', [
'@entity_label' => $link && $path ? $path : $view
->label(),
'@entity_id' => "{$view->id()}:{$executable->current_display}",
]);
}
}
}
$label = parent::label();
return isset($label) ? trim($label) : NULL;
}
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'uid' => \Drupal::currentUser()
->id(),
];
}
/**
* {@inheritdoc}
*/
public function save() {
// Only save overridden settings.
$this
->set('settings', $this
->getSettings()
->getOverridden());
return parent::save();
}
/**
* {@inheritdoc}
*/
public function setOwnerId($uid) {
$this
->set('uid', $uid);
return $this;
}
/**
* {@inheritdoc}
*/
public function setOwner(UserInterface $account) {
$this
->set('uid', $account
->id());
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BackgroundImage:: |
protected | property | ||
BackgroundImage:: |
protected | property | ||
BackgroundImage:: |
protected | property | ||
BackgroundImage:: |
protected | property | ||
BackgroundImage:: |
protected | property | ||
BackgroundImage:: |
protected | property | ||
BackgroundImage:: |
protected | property | ||
BackgroundImage:: |
public | function |
Associates a specific entity with the background image. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public static | function |
Provides base field definitions for an entity type. Overrides ContentEntityBase:: |
|
BackgroundImage:: |
protected | function | ||
BackgroundImage:: |
public | function |
Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
The cache tags associated with this object. Overrides EntityBase:: |
|
BackgroundImage:: |
protected | function | Retrieves the Container. | |
BackgroundImage:: |
public | function | ||
BackgroundImage:: |
public | function |
Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Retrieves the CSS file this background image. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
protected | function | Retrieves the Entity Repository service. | |
BackgroundImage:: |
public | function |
Retrieves the image file. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Retrieves the image based hash. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Retrieves the URL for the image. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function | Returns the currently set langcode for the entity. | |
BackgroundImage:: |
public | function |
Returns the entity owner's user entity. Overrides EntityOwnerInterface:: |
|
BackgroundImage:: |
public | function |
Returns the entity owner's user ID. Overrides EntityOwnerInterface:: |
|
BackgroundImage:: |
public | function |
Retrieves the parent background image, if one exists. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Retrieves the settings for this background image. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Retrieves the settings hash. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Retrieves the target identifier that is specific to the type. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Retrieves the target entity, if the type is supported and exists. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Retrieves the target entity bundle, if the type is supported and exists. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Retrieves the target entity view, if the type is supported and exists. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
The type. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
The type label. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public static | function |
Retrieves all the types. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Indicates whether this background image contains entity based tokens. Overrides BackgroundImageInterface:: |
|
BackgroundImage:: |
public | function |
Gets the label of the entity. Overrides ContentEntityBase:: |
|
BackgroundImage:: |
public static | function |
Changes the values of an entity before it is created. Overrides EntityBase:: |
|
BackgroundImage:: |
public | function |
Saves an entity permanently. Overrides EntityBase:: |
|
BackgroundImage:: |
public | function |
Sets the entity owner's user entity. Overrides EntityOwnerInterface:: |
|
BackgroundImage:: |
public | function |
Sets the entity owner's user ID. Overrides EntityOwnerInterface:: |
|
BackgroundImage:: |
public | function |
Overrides ContentEntityBase:: |
|
BackgroundImageInterface:: |
constant | Never blur the background image. | ||
BackgroundImageInterface:: |
constant | Always blur the background image. | ||
BackgroundImageInterface:: |
constant | Only blur the background image after the user has scrolled. | ||
BackgroundImageInterface:: |
constant | Same as BLUR_SCROLL, but also only if using the full_viewport setting. | ||
BackgroundImageInterface:: |
constant | General value to indicate "inherit". | ||
BackgroundImageInterface:: |
constant | General value to indicate "normal". | ||
BackgroundImageInterface:: |
constant | Attached to an entity. | ||
BackgroundImageInterface:: |
constant | Attached to an entity bundle. | ||
BackgroundImageInterface:: |
constant | Attached to whole site. | ||
BackgroundImageInterface:: |
constant | Attached to a path or multiple paths. | ||
BackgroundImageInterface:: |
constant | Attached to a route or multiple routes. | ||
BackgroundImageInterface:: |
constant | Attached to a view page. | ||
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. | |
ContentEntityBase:: |
protected | property | Language code identifying the entity active language. | |
ContentEntityBase:: |
protected | property | Local cache for the default language code. | |
ContentEntityBase:: |
protected | property | The default langcode entity key. | |
ContentEntityBase:: |
protected | property | Whether the revision translation affected flag has been enforced. | |
ContentEntityBase:: |
protected | property | Holds untranslatable entity keys such as the ID, bundle, and revision ID. | |
ContentEntityBase:: |
protected | property | Local cache for field definitions. | |
ContentEntityBase:: |
protected | property | The array of fields, each being an instance of FieldItemListInterface. | |
ContentEntityBase:: |
protected static | property | Local cache for fields to skip from the checking for translation changes. | |
ContentEntityBase:: |
protected | property | Indicates whether this is the default revision. | |
ContentEntityBase:: |
protected | property | The language entity key. | |
ContentEntityBase:: |
protected | property | Local cache for the available language objects. | |
ContentEntityBase:: |
protected | property | The loaded revision ID before the new revision was set. | |
ContentEntityBase:: |
protected | property | Boolean indicating whether a new revision should be created on save. | |
ContentEntityBase:: |
protected | property | The revision translation affected entity key. | |
ContentEntityBase:: |
protected | property | Holds translatable entity keys such as the label. | |
ContentEntityBase:: |
protected | property | A flag indicating whether a translation object is being initialized. | |
ContentEntityBase:: |
protected | property | An array of entity translation metadata. | |
ContentEntityBase:: |
protected | property | Whether entity validation was performed. | |
ContentEntityBase:: |
protected | property | Whether entity validation is required before saving the entity. | |
ContentEntityBase:: |
protected | property | The plain data values of the contained fields. | |
ContentEntityBase:: |
public | function |
Checks data value access. Overrides EntityBase:: |
1 |
ContentEntityBase:: |
public | function |
Adds a new translation to the translatable object. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the bundle of the entity. Overrides EntityBase:: |
|
ContentEntityBase:: |
public static | function |
Provides field definitions for a specific bundle. Overrides FieldableEntityInterface:: |
4 |
ContentEntityBase:: |
protected | function | Clear entity translation object cache to remove stale references. | |
ContentEntityBase:: |
public | function |
Creates a duplicate of the entity. Overrides EntityBase:: |
1 |
ContentEntityBase:: |
public | function |
Gets a field item list. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Gets the value of the given entity key, if defined. | 1 |
ContentEntityBase:: |
public | function |
Gets the definition of a contained field. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of field definitions of all contained fields. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of all field item lists. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Returns an array of field names to skip in ::hasTranslationChanges. | 1 |
ContentEntityBase:: |
public | function | ||
ContentEntityBase:: |
protected | function | ||
ContentEntityBase:: |
public | function |
Gets the loaded Revision ID of the entity. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the revision identifier of the entity. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of field item lists for translatable fields. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Gets a translated field. | |
ContentEntityBase:: |
public | function |
Gets a translation of the data. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the languages the data is translated to. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the translation status. Overrides TranslationStatusInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the translatable object referring to the original language. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Determines whether the entity has a field with the given name. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Checks there is a translation for the given language code. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Determines if the current translation of the entity has unsaved changes. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the identifier. Overrides EntityBase:: |
|
ContentEntityBase:: |
protected | function | Instantiates a translation object for an existing translation. | |
ContentEntityBase:: |
public | function |
Checks if this entity is the default revision. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the translation is the default one. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks if untranslatable fields should affect only the default translation. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks if this entity is the latest revision. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether this is the latest revision affecting this translation. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Determines whether a new revision should be created on save. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the translation is new. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the current translation is affected by the current revision. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks if the revision translation affected flag value has been enforced. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Returns the translation support status. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether entity validation is required before saving the entity. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets the language of the entity. Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function |
Reacts to changes to a field. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Acts on a created entity before hooks are invoked. Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function |
Acts on a saved entity before the insert or update hook is invoked. Overrides EntityBase:: |
5 |
ContentEntityBase:: |
public | function |
Acts on an entity before the presave hook is invoked. Overrides EntityBase:: |
5 |
ContentEntityBase:: |
public | function |
Acts on a revision before it gets saved. Overrides RevisionableInterface:: |
2 |
ContentEntityBase:: |
public | function |
Gets a list of entities referenced by this entity. Overrides EntityBase:: |
1 |
ContentEntityBase:: |
public | function |
Removes the translation identified by the given language code. Overrides TranslatableInterface:: |
|
ContentEntityBase:: |
public | function |
Sets a field value. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
protected | function | Populates the local cache for the default language code. | |
ContentEntityBase:: |
public | function |
Enforces an entity to be saved as a new revision. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Marks the current revision translation as affected. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Enforces the revision translation affected flag value. Overrides TranslatableRevisionableInterface:: |
|
ContentEntityBase:: |
public | function |
Sets whether entity validation is required before saving the entity. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Gets an array of all property values. Overrides EntityBase:: |
|
ContentEntityBase:: |
protected | function | Updates language for already instantiated fields. | |
ContentEntityBase:: |
public | function |
Updates the loaded Revision ID with the revision ID. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function | Updates the original values with the interim changes. | |
ContentEntityBase:: |
public | function |
Gets the entity UUID (Universally Unique Identifier). Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function |
Validates the currently set values. Overrides FieldableEntityInterface:: |
|
ContentEntityBase:: |
public | function |
Checks whether the entity object was a default revision when it was saved. Overrides RevisionableInterface:: |
|
ContentEntityBase:: |
public | function | Magic method: Implements a deep clone. | |
ContentEntityBase:: |
public | function |
Constructs an Entity object. Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function | Implements the magic method for getting object properties. | |
ContentEntityBase:: |
public | function | Implements the magic method for isset(). | |
ContentEntityBase:: |
public | function | Implements the magic method for setting object properties. | |
ContentEntityBase:: |
public | function | Implements the magic method for unset(). | |
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 | |
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 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 |
Returns the cache tags that should be used to invalidate caches. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets the key that is used to store configuration dependencies. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the configuration dependency name. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Gets the configuration target identifier for the entity. Overrides EntityInterface:: |
1 |
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 the original ID. Overrides EntityInterface:: |
1 |
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:: |
protected static | function | Invalidates an entity's cache tags upon delete. | 1 |
EntityBase:: |
protected | function | Invalidates an entity's cache tags upon save. | 1 |
EntityBase:: |
public | function |
Determines whether the entity is new. Overrides EntityInterface:: |
2 |
EntityBase:: |
protected | function | Gets the language manager. | |
EntityBase:: |
public | function |
Deprecated way of generating a link to the entity. See toLink(). Overrides EntityInterface:: |
1 |
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 static | function |
Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface:: |
16 |
EntityBase:: |
public static | function |
Acts on loaded entities. Overrides EntityInterface:: |
2 |
EntityBase:: |
public static | function |
Acts on entities before they are deleted and before hooks are invoked. Overrides EntityInterface:: |
4 |
EntityBase:: |
public | function |
Sets the original ID. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Generates the HTML for a link to this entity. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets a list of URI relationships supported by this entity. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the public URL for this entity. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets an array of placeholders for this entity. | 2 |
EntityBase:: |
protected | function | Gets the UUID generator. | |
EntityChangedTrait:: |
public | function | Gets the timestamp of the last entity change for the current translation. | |
EntityChangedTrait:: |
public | function | Returns the timestamp of the last entity change across all translations. | |
EntityChangedTrait:: |
public | function | Sets the timestamp of the last entity change for the current translation. | |
EntityChangesDetectionTrait:: |
protected | function | Returns an array of field names to skip when checking for changes. Aliased as: traitGetFieldsToSkipFromTranslationChangesCheck | |
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
SynchronizableEntityTrait:: |
protected | property | Whether this entity is being created, updated or deleted through a synchronization process. | |
SynchronizableEntityTrait:: |
public | function | ||
SynchronizableEntityTrait:: |
public | function | ||
TranslationStatusInterface:: |
constant | Status code identifying a newly created translation. | ||
TranslationStatusInterface:: |
constant | Status code identifying an existing translation. | ||
TranslationStatusInterface:: |
constant | Status code identifying a removed translation. |