class PhotosImage in Album Photos 6.0.x
Same name in this branch
- 6.0.x src/Entity/PhotosImage.php \Drupal\photos\Entity\PhotosImage
- 6.0.x src/Plugin/migrate/source/PhotosImage.php \Drupal\photos\Plugin\migrate\source\PhotosImage
- 6.0.x src/Plugin/migrate/destination/PhotosImage.php \Drupal\photos\Plugin\migrate\destination\PhotosImage
Same name and namespace in other branches
- 8.5 src/Entity/PhotosImage.php \Drupal\photos\Entity\PhotosImage
Defines the photos image entity class.
@todo Remove default/fallback entity form operation when #2006348 is done.
Plugin annotation
@ContentEntityType(
id = "photos_image",
label = @Translation("Photo"),
label_collection = @Translation("Photos"),
label_singular = @Translation("photo"),
label_plural = @Translation("photos"),
label_count = @PluralTranslation(
singular = "@count photo",
plural = "@count photos"
),
handlers = {
"storage" = "Drupal\photos\PhotosImageStorage",
"storage_schema" = "Drupal\photos\PhotosImageStorageSchema",
"form" = {
"default" = "Drupal\photos\Form\PhotosImageAddForm",
"add" = "Drupal\photos\Form\PhotosImageAddForm",
"edit" = "Drupal\photos\Form\PhotosImageEditForm",
"delete" = "Drupal\photos\Form\PhotosImageDeleteForm",
"delete-multiple-confirm" = "Drupal\Core\Entity\Form\DeleteMultipleForm",
},
"access" = "Drupal\photos\PhotosAccessControlHandler",
"views_data" = "Drupal\photos\PhotosViewsData",
"list_builder" = "Drupal\photos\PhotosImageListBuilder",
"route_provider" = {
"html" = "Drupal\photos\Entity\PhotosRouteProvider",
}
},
base_table = "photos_image",
data_table = "photos_image_field_data",
revision_table = "photos_image_revision",
revision_data_table = "photos_image_field_revision",
translatable = TRUE,
show_revision_ui = TRUE,
entity_keys = {
"id" = "id",
"revision" = "revision_id",
"label" = "title",
"langcode" = "langcode",
"uuid" = "uuid",
"status" = "status",
"published" = "status",
"uid" = "uid",
"owner" = "uid",
},
revision_metadata_keys = {
"revision_user" = "revision_user",
"revision_created" = "revision_created",
"revision_log_message" = "revision_log_message",
},
admin_permission = "administer nodes",
common_reference_target = TRUE,
field_ui_base_route = "photos.admin",
links = {
"canonical" = "/photos/{node}/{photos_image}",
"add-form" = "/photos/image/add",
"collection" = "/admin/content/photos",
"delete-form" = "/photos/{node}/{photos_image}/delete",
"edit-form" = "/photos/{node}/{photos_image}/edit",
"version-history" = "/photos/{node}/{photos_image}/revisions",
"revision" = "/photos/{node}/{photos_image}/revisions/{photos_image_revision}/view",
}
)
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\Core\Entity\EditorialContentEntityBase implements EntityChangedInterface, EntityPublishedInterface, RevisionLogInterface uses EntityChangedTrait, EntityPublishedTrait, RevisionLogEntityTrait
- class \Drupal\photos\Entity\PhotosImage implements PhotosImageInterface uses StringTranslationTrait, EntityOwnerTrait
- class \Drupal\Core\Entity\EditorialContentEntityBase implements EntityChangedInterface, EntityPublishedInterface, RevisionLogInterface uses EntityChangedTrait, EntityPublishedTrait, RevisionLogEntityTrait
- class \Drupal\Core\Entity\ContentEntityBase implements \Drupal\Core\Entity\IteratorAggregate, ContentEntityInterface, TranslationStatusInterface uses EntityChangesDetectionTrait, SynchronizableEntityTrait
Expanded class hierarchy of PhotosImage
See also
https://www.drupal.org/node/2006348.
4 files declare their use of PhotosImage
- PhotosAccessTest.php in photos_access/
tests/ src/ Functional/ PhotosAccessTest.php - PhotosImageCover.php in src/
Plugin/ views/ field/ PhotosImageCover.php - PhotosImageSearch.php in src/
Plugin/ Search/ PhotosImageSearch.php - PhotosUpload.php in src/
PhotosUpload.php
File
- src/
Entity/ PhotosImage.php, line 87
Namespace
Drupal\photos\EntityView source
class PhotosImage extends EditorialContentEntityBase implements PhotosImageInterface {
// @todo revision ui @see node.
use EntityOwnerTrait;
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
foreach (array_keys($this
->getTranslationLanguages()) as $langcode) {
$translation = $this
->getTranslation($langcode);
// If no owner has been set explicitly, make the anonymous user the owner.
if (!$translation
->getOwner()) {
$translation
->setOwnerId(0);
}
}
// If no revision author has been set explicitly, make the image owner the
// revision author.
if (!$this
->getRevisionUser()) {
$this
->setRevisionUserId($this
->getOwnerId());
}
// @todo check media and look into creating thumbnails and any other
// derivatives.
}
/**
* {@inheritdoc}
*/
public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) {
parent::preSaveRevision($storage, $record);
$is_new_revision = $this
->isNewRevision();
if (!$is_new_revision && isset($this->original) && empty($record->revision_log_message)) {
// If we are updating an existing media item without adding a
// new revision, we need to make sure $entity->revision_log_message is
// reset whenever it is empty.
// Therefore, this code allows us to avoid clobbering an existing log
// entry with an empty one.
$record->revision_log_message = $this->original->revision_log_message->value;
}
if ($is_new_revision) {
$record->revision_created = self::getRequestTime();
}
}
/**
* {@inheritdoc}
*/
public static function preDelete(EntityStorageInterface $storage, array $entities) {
parent::preDelete($storage, $entities);
// @see PhotosImageFile::delete.
// @todo move count updates to entity delete form?
foreach ($entities as $entity) {
$album_id = $entity
->getAlbumId();
// Clear cache.
Cache::invalidateTags([
'node:' . $album_id,
'photos:album:' . $album_id,
]);
Cache::invalidateTags([
'photos:image:' . $entity
->id(),
]);
}
}
/**
* {@inheritdoc}
*/
public function getFids() {
$fids = [];
$photosImageFields = \Drupal::service('entity_field.manager')
->getFieldDefinitions('photos_image', 'photos_image');
// @todo warn if other unhandled fields exist?
foreach ($photosImageFields as $key => $field) {
/** @var \Drupal\Core\Field\FieldDefinitionInterface $field */
$fieldType = $field
->getType();
if ($fieldType == 'file' || $fieldType == 'image') {
// Check image and file fields.
foreach ($this->{$key} as $item) {
$fids[$item->entity
->id()] = $item->entity
->id();
}
}
elseif ($fieldType == 'entity_reference') {
// Check media fields.
$settings = $field
->getSettings();
if ($settings['target_type'] == 'media') {
foreach ($this->{$key} as $item) {
$media = Media::load($item->entity
->id());
// @todo maybe getSourceFieldDefinition here?
$fid = $media
->getSource()
->getSourceFieldValue($media);
$fids[$fid] = $fid;
}
}
}
}
return $fids;
}
/**
* {@inheritdoc}
*/
public function getTitle() {
return $this
->get('title')->value;
}
/**
* {@inheritdoc}
*/
public function setTitle($title) {
$this
->set('title', $title);
return $this;
}
/**
* {@inheritdoc}
*/
public function getDescription() {
return $this
->get('description')->value;
}
/**
* {@inheritdoc}
*/
public function setDescription($description) {
$this
->set('description', $description);
return $this;
}
/**
* {@inheritdoc}
*/
public function getFormat() {
return $this
->get('description')->format;
}
/**
* {@inheritdoc}
*/
public function setFormat($format) {
$this
->get('description')->format = $format;
return $this;
}
/**
* {@inheritdoc}
*/
public function getAlbumId() {
return $this
->get('album_id')->target_id;
}
/**
* {@inheritdoc}
*/
public function setAlbumId($album_id) {
$this
->set('album_id', $album_id);
return $this;
}
/**
* {@inheritdoc}
*/
public function getAlbumUrl() {
$album_link_override = \Drupal::config('photos.settings')
->get('album_link_override');
if ($album_link_override) {
$album_link_override = str_replace(':', '.', $album_link_override);
// @todo add support for other arguments?
$url = Url::fromRoute('view.' . $album_link_override, [
'node' => $this
->getAlbumId(),
]);
}
else {
// Default to the photo album node page.
$url = Url::fromRoute('entity.node.canonical', [
'node' => $this
->getAlbumId(),
]);
}
return $url;
}
/**
* {@inheritdoc}
*/
public function getWeight() {
return $this
->get('weight')->value;
}
/**
* {@inheritdoc}
*/
public function setWeight($weight) {
$this
->set('weight', $weight);
return $this;
}
/**
* {@inheritdoc}
*/
public function getCreatedTime() {
return $this
->get('created')->value;
}
/**
* {@inheritdoc}
*/
public function setCreatedTime($timestamp) {
$this
->set('created', $timestamp);
return $this;
}
/**
* Gets an array of placeholders for this entity.
*
* Individual entity classes may override this method to add additional
* placeholders if desired. If so, they should be sure to replicate the
* property caching logic.
*
* @param string $rel
* The link relationship type, for example: canonical or edit-form.
*
* @return array
* An array of URI placeholders.
*/
protected function urlRouteParameters($rel) {
$uri_route_parameters = [];
if (!in_array($rel, [
'collection',
'add-page',
'add-form',
], TRUE)) {
// The entity ID is needed as a route parameter.
$uri_route_parameters[$this
->getEntityTypeId()] = $this
->id();
// Include album node ID.
$uri_route_parameters['node'] = $this
->getAlbumId();
}
if ($rel === 'add-form' && $this
->getEntityType()
->hasKey('bundle')) {
$parameter_name = $this
->getEntityType()
->getBundleEntityType() ?: $this
->getEntityType()
->getKey('bundle');
$uri_route_parameters[$parameter_name] = $this
->bundle();
}
if ($rel === 'revision' && $this instanceof RevisionableInterface) {
$uri_route_parameters[$this
->getEntityTypeId() . '_revision'] = $this
->getRevisionId();
}
return $uri_route_parameters;
}
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields += static::ownerBaseFieldDefinitions($entity_type);
$fields['title'] = BaseFieldDefinition::create('string')
->setLabel(t('Title'))
->setDescription(t('The image title.'))
->setRequired(TRUE)
->setTranslatable(TRUE)
->setRevisionable(TRUE)
->setSetting('max_length', 255)
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'string',
'weight' => -5,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -5,
])
->setDisplayConfigurable('form', TRUE);
// @todo migrate fid to new field_image field.
// @todo Add an admin setting to select default image or file field for
// upload form? Check if field exists when upload form loads. OR display
// message to add field_image to photos_image to enable the upload form?
$fields['description'] = BaseFieldDefinition::create('text_long')
->setLabel(t('Description'))
->setDescription(t('The image description field.'))
->setTranslatable(TRUE)
->setRevisionable(TRUE)
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'text_default',
'weight' => 1,
])
->setDisplayConfigurable('view', TRUE)
->setDisplayOptions('form', [
'type' => 'text_textfield',
'weight' => 1,
])
->setDisplayConfigurable('form', TRUE);
// @todo look at media thumbnail to use for album cover.
// @todo get default image style from config settings (or field settings).
$fields['uid']
->setLabel(t('Authored by'))
->setDescription(t('The username of the author.'))
->setRevisionable(TRUE)
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'author',
'weight' => -3,
])
->setDisplayConfigurable('view', TRUE)
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 4,
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'placeholder' => '',
],
])
->setDisplayConfigurable('form', TRUE);
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Authored on'))
->setDescription(t('The time that the image was created.'))
->setRevisionable(TRUE)
->setTranslatable(TRUE)
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'timestamp',
'weight' => -2,
])
->setDisplayConfigurable('view', TRUE)
->setDisplayOptions('form', [
'type' => 'datetime_timestamp',
'weight' => 5,
])
->setDisplayConfigurable('form', TRUE);
// @todo target_type photos_album if entity is used for album.
$fields['album_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Album ID'))
->setDescription(t('The album node ID.'))
->setRequired(TRUE)
->setRevisionable(TRUE)
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'entity_reference_label',
'weight' => -1,
])
->setDisplayConfigurable('view', TRUE)
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 3,
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'placeholder' => '',
],
])
->setSetting('target_type', 'node')
->setDisplayConfigurable('form', TRUE);
$fields['status']
->setDisplayOptions('form', [
'type' => 'boolean_checkbox',
'settings' => [
'display_label' => TRUE,
],
'weight' => 120,
])
->setDisplayConfigurable('form', TRUE);
$fields['weight'] = BaseFieldDefinition::create('integer')
->setLabel(t('Weight'))
->setDescription(t('The image weight for custom sort order.'))
->setDefaultValue(0)
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'number_integer',
])
->setDisplayConfigurable('view', TRUE)
->setDisplayOptions('form', [
'type' => 'number',
'weight' => 20,
])
->setDisplayConfigurable('form', TRUE);
$fields['changed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Changed'))
->setDescription(t('The time that the image was last edited.'))
->setRevisionable(TRUE)
->setTranslatable(TRUE);
return $fields;
}
/**
* {@inheritdoc}
*/
public static function getRequestTime() {
return \Drupal::time()
->getRequestTime();
}
/**
* {@inheritdoc}
*/
public function getPager($id, $type = 'album_id') {
$entity_id = $this
->id();
$db = \Drupal::database();
$query = $db
->select('photos_image_field_data', 'p');
$query
->innerJoin('node_field_data', 'n', 'n.nid = p.album_id');
$query
->fields('p', [
'id',
'album_id',
]);
$query
->fields('n', [
'title',
]);
// Default order by id.
$order = [
'column' => 'p.id',
'sort' => 'DESC',
];
if ($type == 'album_id') {
// Viewing album.
// Order images by album settings.
$album_data = $db
->query('SELECT data FROM {photos_album} WHERE album_id = :album_id', [
':album_id' => $id,
])
->fetchField();
// @todo look into core serialization API.
// @see https://www.drupal.org/docs/8/api/serialization-api/serialization-api-overview
$album_data = unserialize($album_data);
$default_order = \Drupal::config('photos.settings')
->get('photos_display_imageorder');
$image_order = isset($album_data['imageorder']) ? $album_data['imageorder'] : $default_order;
$order = explode('|', $image_order);
$order = PhotosAlbum::orderValueChange($order[0], $order[1]);
$query
->condition('p.album_id', $id);
}
elseif ($type == 'uid') {
// Viewing all user images.
$query
->condition('p.uid', $id);
}
$query
->orderBy($order['column'], $order['sort']);
if ($order['column'] != 'p.id') {
$query
->orderBy('p.id', 'DESC');
}
$results = $query
->execute();
$stop = $pager['prev'] = $pager['next'] = 0;
$num = 0;
// @todo use view mode.
$previousImageId = NULL;
$photosImageStorage = \Drupal::entityTypeManager()
->getStorage('photos_image');
$photosImageViewBuilder = \Drupal::entityTypeManager()
->getViewBuilder('photos_image');
foreach ($results as $result) {
$num++;
// @todo new pager display view mode.
if ($stop == 1) {
$photosImage = $photosImageStorage
->load($result->id);
$image_view = $photosImageViewBuilder
->view($photosImage, 'pager');
$pager['nextView'] = $image_view;
// Next image.
$pager['nextUrl'] = Url::fromRoute('entity.photos_image.canonical', [
'node' => $result->album_id,
'photos_image' => $photosImage
->id(),
])
->toString();
break;
}
if ($result->id == $entity_id) {
$photosImage = $photosImageStorage
->load($result->id);
$image_view = $photosImageViewBuilder
->view($photosImage, 'pager');
$pager['currentView'] = $image_view;
$stop = 1;
}
else {
$previousImageId = $result->id;
}
$pager['albumTitle'] = $result->title;
}
if ($previousImageId) {
$photosImage = $photosImageStorage
->load($previousImageId);
$image_view = $photosImageViewBuilder
->view($photosImage, 'pager');
$pager['prevView'] = $image_view;
// Previous image.
$pager['prevUrl'] = Url::fromRoute('entity.photos_image.canonical', [
'node' => $id,
'photos_image' => $photosImage
->id(),
])
->toString();
}
// @todo theme photos_pager with options for image and no-image.
return $pager;
}
}
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. | |
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 label of the entity. Overrides EntityBase:: |
6 |
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:: |
9 |
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:: |
1 |
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 |
Overrides EntityBase:: |
|
ContentEntityBase:: |
public | function | Implements the magic method for unset(). | |
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | Aliased as: traitSleep | 2 |
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 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 |
Returns the cache tags that should be used to invalidate caches. Overrides EntityInterface:: |
4 |
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 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:: |
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:: |
18 |
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:: |
7 |
EntityBase:: |
public | function |
Saves an entity permanently. Overrides EntityInterface:: |
3 |
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:: |
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 | |
EntityOwnerTrait:: |
public static | function | Default value callback for 'owner' base field. | 1 |
EntityOwnerTrait:: |
public | function | 1 | |
EntityOwnerTrait:: |
public | function | ||
EntityOwnerTrait:: |
public static | function | Returns an array of base field definitions for entity owners. | |
EntityOwnerTrait:: |
public | function | ||
EntityOwnerTrait:: |
public | function | ||
EntityPublishedTrait:: |
public | function | ||
EntityPublishedTrait:: |
public static | function | Returns an array of base field definitions for publishing status. | |
EntityPublishedTrait:: |
public | function | ||
EntityPublishedTrait:: |
public | function | ||
PhotosImage:: |
public static | function |
Provides base field definitions for an entity type. Overrides EditorialContentEntityBase:: |
|
PhotosImage:: |
public | function |
Gets the image album id. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Gets the album url. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Gets the image creation timestamp. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Gets the image description. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Gets the image file ids. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Gets the text format name for the image description. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Gets the page for this image. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public static | function | ||
PhotosImage:: |
public | function |
Gets the image title. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Gets the image weight. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public static | function |
Acts on entities before they are deleted and before hooks are invoked. Overrides EntityBase:: |
|
PhotosImage:: |
public | function |
Acts on an entity before the presave hook is invoked. Overrides ContentEntityBase:: |
|
PhotosImage:: |
public | function |
Acts on a revision before it gets saved. Overrides ContentEntityBase:: |
|
PhotosImage:: |
public | function |
Sets the image album id. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Sets the image creation timestamp. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Sets the image description. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Sets the text format name for the image description. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Sets the image title. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
public | function |
Sets the image weight for custom sorting. Overrides PhotosImageInterface:: |
|
PhotosImage:: |
protected | function |
Gets an array of placeholders for this entity. Overrides EntityBase:: |
|
PhotosImageInterface:: |
constant | Denotes that the image is not published. | ||
PhotosImageInterface:: |
constant | Denotes that the image is published. | ||
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RevisionLogEntityTrait:: |
abstract public | function | Gets the entity type definition. | |
RevisionLogEntityTrait:: |
public | function | Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionCreationTime(). | 1 |
RevisionLogEntityTrait:: |
public | function | Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionLogMessage(). | 1 |
RevisionLogEntityTrait:: |
protected static | function | Gets the name of a revision metadata field. | |
RevisionLogEntityTrait:: |
public | function | Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionUser(). | 1 |
RevisionLogEntityTrait:: |
public | function | Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionUserId(). | 1 |
RevisionLogEntityTrait:: |
public static | function | Provides revision-related base field definitions for an entity type. | |
RevisionLogEntityTrait:: |
public | function | Implements \Drupal\Core\Entity\RevisionLogInterface::setRevisionCreationTime(). | 1 |
RevisionLogEntityTrait:: |
public | function | Implements \Drupal\Core\Entity\RevisionLogInterface::setRevisionLogMessage(). | 1 |
RevisionLogEntityTrait:: |
public | function | Implements \Drupal\Core\Entity\RevisionLogInterface::setRevisionUser(). | 1 |
RevisionLogEntityTrait:: |
public | function | Implements \Drupal\Core\Entity\RevisionLogInterface::setRevisionUserId(). | 1 |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
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. |