Drupal 8  8.0.2
ContentEntityBase Class Reference
Inheritance diagram for ContentEntityBase:

Public Member Functions

 __construct (array $values, $entity_type, $bundle=FALSE, $translations=array())
 
 postCreate (EntityStorageInterface $storage)
 
 setNewRevision ($value=TRUE)
 
 isNewRevision ()
 
 isDefaultRevision ($new_value=NULL)
 
 isRevisionTranslationAffected ()
 
 setRevisionTranslationAffected ($affected)
 
 isDefaultTranslation ()
 
 getRevisionId ()
 
 isTranslatable ()
 
 preSave (EntityStorageInterface $storage)
 
 preSaveRevision (EntityStorageInterface $storage,\stdClass $record)
 
 validate ()
 
 isValidationRequired ()
 
 setValidationRequired ($required)
 
 __sleep ()
 
 id ()
 
 bundle ()
 
 uuid ()
 
 hasField ($field_name)
 
 get ($field_name)
 
 set ($name, $value, $notify=TRUE)
 
 getFields ($include_computed=TRUE)
 
 getTranslatableFields ($include_computed=TRUE)
 
 getIterator ()
 
 getFieldDefinition ($name)
 
 getFieldDefinitions ()
 
 toArray ()
 
 access ($operation, AccountInterface $account=NULL, $return_as_object=FALSE)
 
 language ()
 
 onChange ($name)
 
 getTranslation ($langcode)
 
 getUntranslated ()
 
 hasTranslation ($langcode)
 
 isNewTranslation ()
 
 removeTranslation ($langcode)
 
 getTranslationLanguages ($include_default=TRUE)
 
 updateOriginalValues ()
 
__get ($name)
 
 __set ($name, $value)
 
 __isset ($name)
 
 __unset ($name)
 
 createDuplicate ()
 
 __clone ()
 
 label ()
 
 referencedEntities ()
 
- Public Member Functions inherited from Entity
 __construct (array $values, $entity_type)
 
 id ()
 
 uuid ()
 
 isNew ()
 
 enforceIsNew ($value=TRUE)
 
 getEntityTypeId ()
 
 bundle ()
 
 label ()
 
 urlInfo ($rel= 'canonical', array $options=[])
 
 toUrl ($rel= 'canonical', array $options=[])
 
 hasLinkTemplate ($rel)
 
 link ($text=NULL, $rel= 'canonical', array $options=[])
 
 toLink ($text=NULL, $rel= 'canonical', array $options=[])
 
 url ($rel= 'canonical', $options=array())
 
 uriRelationships ()
 
 access ($operation, AccountInterface $account=NULL, $return_as_object=FALSE)
 
 language ()
 
 save ()
 
 delete ()
 
 createDuplicate ()
 
 getEntityType ()
 
 preSave (EntityStorageInterface $storage)
 
 postSave (EntityStorageInterface $storage, $update=TRUE)
 
 postCreate (EntityStorageInterface $storage)
 
 referencedEntities ()
 
 getCacheContexts ()
 
 getCacheTagsToInvalidate ()
 
 getCacheTags ()
 
 getCacheMaxAge ()
 
 getOriginalId ()
 
 setOriginalId ($id)
 
 toArray ()
 
 getTypedData ()
 
 __sleep ()
 
 getConfigDependencyKey ()
 
 getConfigDependencyName ()
 
 getConfigTarget ()
 
- Public Member Functions inherited from RefinableCacheableDependencyInterface
 addCacheContexts (array $cache_contexts)
 
 addCacheTags (array $cache_tags)
 
 mergeCacheMaxAge ($max_age)
 
 addCacheableDependency ($other_object)
 
- Public Member Functions inherited from ContentEntityInterface
 hasTranslationChanges ()
 
- Public Member Functions inherited from TranslatableInterface
 addTranslation ($langcode, array $values=array())
 

Static Public Member Functions

static bundleFieldDefinitions (EntityTypeInterface $entity_type, $bundle, array $base_field_definitions)
 
- Static Public Member Functions inherited from Entity
static preCreate (EntityStorageInterface $storage, array &$values)
 
static preDelete (EntityStorageInterface $storage, array $entities)
 
static postDelete (EntityStorageInterface $storage, array $entities)
 
static postLoad (EntityStorageInterface $storage, array &$entities)
 
static load ($id)
 
static loadMultiple (array $ids=NULL)
 
static create (array $values=array())
 
- Static Public Member Functions inherited from FieldableEntityInterface
static baseFieldDefinitions (EntityTypeInterface $entity_type)
 

Data Fields

const TRANSLATION_REMOVED = 0
 
const TRANSLATION_EXISTING = 1
 
const TRANSLATION_CREATED = 2
 

Protected Member Functions

 getLanguages ()
 
 clearTranslationCache ()
 
 getTranslatedField ($name, $langcode)
 
 setDefaultLangcode ()
 
 updateFieldLangcodes ($langcode)
 
 initializeTranslation ($langcode)
 
 getEntityKey ($key)
 
- Protected Member Functions inherited from Entity
 entityManager ()
 
 entityTypeManager ()
 
 languageManager ()
 
 uuidGenerator ()
 
 linkTemplates ()
 
 urlRouteParameters ($rel)
 
 invalidateTagsOnSave ($update)
 

Protected Attributes

 $values = array()
 
 $fields = array()
 
 $fieldDefinitions
 
 $languages
 
 $langcodeKey
 
 $defaultLangcodeKey
 
 $activeLangcode = LanguageInterface::LANGCODE_DEFAULT
 
 $defaultLangcode
 
 $translations = array()
 
 $translationInitialize = FALSE
 
 $newRevision = FALSE
 
 $isDefaultRevision = TRUE
 
 $entityKeys = array()
 
 $translatableEntityKeys = array()
 
 $validated = FALSE
 
 $validationRequired = FALSE
 
- Protected Attributes inherited from Entity
 $entityTypeId
 
 $enforceIsNew
 
 $typedData
 

Additional Inherited Members

- Static Protected Member Functions inherited from Entity
static invalidateTagsOnDelete (EntityTypeInterface $entity_type, array $entities)
 

Detailed Description

Implements Entity Field API specific enhancements to the Entity class.

Constructor & Destructor Documentation

__construct ( array  $values,
  $entity_type,
  $bundle = FALSE,
  $translations = array() 
)

{}

References Entity\getEntityType(), ContentEntityBase\getFieldDefinition(), ContentEntityBase\isTranslatable(), LanguageInterface\LANGCODE_DEFAULT, and ContentEntityBase\setDefaultLangcode().

Here is the call graph for this function:

Member Function Documentation

__clone ( )

Magic method: Implements a deep clone.

& __get (   $name)

Implements the magic method for getting object properties.

Todo:
: A lot of code still uses non-fields (e.g. $entity->content in view builders) by reference. Clean that up.

References ContentEntityBase\getFieldDefinitions(), and ContentEntityBase\getTranslatedField().

Here is the call graph for this function:

__isset (   $name)

Implements the magic method for isset().

References ContentEntityBase\hasField().

Here is the call graph for this function:

__set (   $name,
  $value 
)

Implements the magic method for setting object properties.

Uses default language always.

References ContentEntityBase\getFieldDefinitions(), and ContentEntityBase\getTranslatedField().

Here is the call graph for this function:

__sleep ( )

{}

References ContentEntityBase\clearTranslationCache().

Here is the call graph for this function:

__unset (   $name)

Implements the magic method for unset().

References ContentEntityBase\hasField().

Here is the call graph for this function:

access (   $operation,
AccountInterface  $account = NULL,
  $return_as_object = FALSE 
)

{Checks data value access.

Parameters
string$operationThe operation to be performed.
\Drupal\Core\Session\AccountInterface$account(optional) The user for which to check access, or NULL to check access for the current user. Defaults to NULL.
bool$return_as_object(optional) Defaults to FALSE.
Returns
bool| The access result. Returns a boolean if $return_as_object is FALSE (this is the default) and otherwise an AccessResultInterface object. When a boolean is returned, the result of AccessInterface::isAllowed() is returned, i.e. TRUE means access is explicitly allowed, FALSE means access is either explicitly forbidden or "no opinion".
}

Implements AccessibleInterface.

References ContentEntityBase\bundle(), and Entity\entityManager().

Here is the call graph for this function:

bundle ( )

{Gets the bundle of the entity.

Returns
string The bundle of the entity. Defaults to the entity type ID if the entity type does not make use of different bundles.
}

Implements EntityInterface.

References ContentEntityBase\getEntityKey().

Referenced by ContentEntityBase\access(), ContentEntityBase\getFieldDefinitions(), Node\getType(), Comment\getTypeId(), Message\isPersonal(), and ContentEntityBase\isTranslatable().

Here is the call graph for this function:

Here is the caller graph for this function:

static bundleFieldDefinitions ( EntityTypeInterface  $entity_type,
  $bundle,
array  $base_field_definitions 
)
static

{Provides field definitions for a specific bundle.This function can return definitions both for bundle fields (fields that are not defined in $base_field_definitions, and therefore might not exist on some bundles) as well as bundle-specific overrides of base fields (fields that are defined in $base_field_definitions, and therefore exist for all bundles). However, bundle-specific base field overrides can also be provided by 'base_field_override' configuration entities, and that is the recommended approach except in cases where an entity type needs to provide a bundle-specific base field override that is decoupled from configuration. Note that for most entity types, the bundles themselves are derived from configuration (e.g., 'node' bundles are managed via 'node_type' configuration entities), so decoupling bundle-specific base field overrides from configuration only makes sense for entity types that also decouple their bundles from configuration. In cases where both this function returns a bundle-specific override of a base field and a 'base_field_override' configuration entity exists, the latter takes precedence.

Parameters
\Drupal\Core\Entity\EntityTypeInterface$entity_typeThe entity type definition. Useful when a single class is used for multiple, possibly dynamic entity types.
string$bundleThe bundle.
\Drupal\Core\Field\FieldDefinitionInterface[]$base_field_definitions The list of base field definitions.
Returns
[] An array of bundle field definitions, keyed by field name.
See Also
::getFieldDefinitions()
::baseFieldDefinitions()
Todo:
WARNING: This method will be changed in https://www.drupal.org/node/2346347.
}

Implements FieldableEntityInterface.

clearTranslationCache ( )
protected

Clear entity translation object cache to remove stale references.

Referenced by ContentEntityBase\__sleep().

Here is the caller graph for this function:

createDuplicate ( )

{Creates a duplicate of the entity.

Returns
static A clone of $this with all identifiers unset, so saving it inserts a new entity into the storage system.
}

Implements EntityInterface.

References Entity\getEntityType().

Here is the call graph for this function:

get (   $field_name)

{Gets a field item list.

Parameters
string$field_nameThe name of the field to get; e.g., 'title' or 'name'.
Returns
The field item list, containing the field items.
Exceptions
\InvalidArgumentExceptionIf an invalid field name is given.
}

Implements FieldableEntityInterface.

References ContentEntityBase\getTranslatedField().

Here is the call graph for this function:

getEntityKey (   $key)
protected

Gets the value of the given entity key, if defined.

Parameters
string$keyName of the entity key, for example id, revision or bundle.
Returns
mixed The value of the entity key, NULL if not defined.

Referenced by ContentEntityBase\bundle(), Node\getOwnerId(), ContentEntityBase\getRevisionId(), ContentEntityBase\id(), Node\isPublished(), and ContentEntityBase\uuid().

Here is the caller graph for this function:

getFieldDefinition (   $name)

{Gets the definition of a contained field.

Parameters
string$nameThe name of the field.
Returns
|null The definition of the field or null if the field does not exist.
}

Implements FieldableEntityInterface.

References ContentEntityBase\getFieldDefinitions().

Referenced by ContentEntityBase\__construct(), ContentEntityBase\getTranslatedField(), and ContentEntityBase\hasField().

Here is the call graph for this function:

Here is the caller graph for this function:

getFieldDefinitions ( )

{Gets an array of field definitions of all contained fields.

Returns
[] An array of field definitions, keyed by field name.
See Also
::getFieldDefinitions()
}

Implements FieldableEntityInterface.

References ContentEntityBase\bundle(), and Entity\entityManager().

Referenced by ContentEntityBase\__get(), ContentEntityBase\__set(), ContentEntityBase\getFieldDefinition(), ContentEntityBase\getFields(), ContentEntityBase\getTranslatableFields(), ContentEntityBase\removeTranslation(), and ContentEntityBase\updateOriginalValues().

Here is the call graph for this function:

Here is the caller graph for this function:

getFields (   $include_computed = TRUE)

{Gets an array of all field item lists.

Parameters
bool$include_computedIf set to TRUE, computed fields are included. Defaults to TRUE.
Returns
[] An array of field item lists implementing, keyed by field name.
}

Implements FieldableEntityInterface.

References ContentEntityBase\getFieldDefinitions().

Referenced by ContentEntityBase\getIterator(), and ContentEntityBase\toArray().

Here is the call graph for this function:

Here is the caller graph for this function:

getIterator ( )

{}

References ContentEntityBase\getFields().

Here is the call graph for this function:

getLanguages ( )
protected

{}

References Entity\languageManager(), and LanguageInterface\STATE_ALL.

Referenced by User\getAllowedConfigurableLanguageCodes(), ContentEntityBase\getTranslationLanguages(), and ContentEntityBase\language().

Here is the call graph for this function:

Here is the caller graph for this function:

getRevisionId ( )

{Gets the revision identifier of the entity.

Returns
The revision identifier of the entity, or NULL if the entity does not have a revision identifier.
}

Implements RevisionableInterface.

References ContentEntityBase\getEntityKey().

Referenced by ContentEntityBase\isNewRevision().

Here is the call graph for this function:

Here is the caller graph for this function:

getTranslatableFields (   $include_computed = TRUE)

{Gets an array of field item lists for translatable fields.

Parameters
bool$include_computedIf set to TRUE, computed fields are included. Defaults to TRUE.
Returns
[] An array of field item lists implementing, keyed by field name.
}

Implements FieldableEntityInterface.

References ContentEntityBase\getFieldDefinitions().

Here is the call graph for this function:

getTranslatedField (   $name,
  $langcode 
)
protected

Gets a translated field.

Returns

References ContentEntityBase\getFieldDefinition(), ContentEntityBase\getTranslation(), LanguageInterface\LANGCODE_DEFAULT, LanguageInterface\LANGCODE_NOT_SPECIFIED, and Drupal\service().

Referenced by ContentEntityBase\__get(), ContentEntityBase\__set(), and ContentEntityBase\get().

Here is the call graph for this function:

Here is the caller graph for this function:

getTranslation (   $langcode)

{Gets a translation of the data.The returned translation has to be of the same type than this typed data object.

Parameters
$langcodeThe language code of the translation to get or LanguageInterface::LANGCODE_DEFAULT to get the data in default language.
Returns
$this A typed data object for the translated data.
Exceptions
\InvalidArgumentExceptionIf an invalid or non-existing translation language is specified.
}

Implements TranslatableInterface.

References ContentEntityBase\initializeTranslation(), and LanguageInterface\LANGCODE_DEFAULT.

Referenced by ContentEntityBase\getTranslatedField(), ContentEntityBase\getUntranslated(), Node\preSave(), and ContentEntityBase\setNewRevision().

Here is the call graph for this function:

Here is the caller graph for this function:

getTranslationLanguages (   $include_default = TRUE)

{Returns the languages the data is translated to.

Parameters
bool$include_default(optional) Whether the default language should be included. Defaults to TRUE.
Returns
[] An associative array of language objects, keyed by language codes.
}

Implements TranslatableInterface.

References ContentEntityBase\getLanguages(), and LanguageInterface\LANGCODE_DEFAULT.

Referenced by Node\preSave().

Here is the call graph for this function:

Here is the caller graph for this function:

getUntranslated ( )

{Returns the translatable object referring to the original language.

Returns
$this The translation object referring to the original language.
}

Implements TranslatableInterface.

References ContentEntityBase\getTranslation(), and LanguageInterface\LANGCODE_DEFAULT.

Referenced by ContentEntityBase\isTranslatable().

Here is the call graph for this function:

Here is the caller graph for this function:

hasField (   $field_name)

{Determines whether the entity has a field with the given name.

Parameters
string$field_nameThe field name.
Returns
bool TRUE if the entity has a field with the given name. FALSE otherwise.
}

Implements FieldableEntityInterface.

References ContentEntityBase\getFieldDefinition().

Referenced by ContentEntityBase\__isset(), ContentEntityBase\__unset(), ContentEntityBase\isRevisionTranslationAffected(), ContentEntityBase\setDefaultLangcode(), and ContentEntityBase\setRevisionTranslationAffected().

Here is the call graph for this function:

Here is the caller graph for this function:

hasTranslation (   $langcode)

{Returns TRUE there is a translation for the given language code.

Parameters
string$langcodeThe language code identifying the translation.
Returns
bool TRUE if the translation exists, FALSE otherwise.
}

Implements TranslatableInterface.

References LanguageInterface\LANGCODE_DEFAULT.

Referenced by ContentEntityBase\setNewRevision().

Here is the caller graph for this function:

id ( )

{Gets the identifier.

Returns
string|int|null The entity identifier, or NULL if the object does not yet have an identifier.
}

Implements EntityInterface.

References ContentEntityBase\getEntityKey().

Referenced by MenuTest\deleteMenuLink(), MenuTest\disableMenuLink(), MenuTest\enableMenuLink(), User\isAnonymous(), User\isAuthenticated(), User\isNew(), MenuTest\modifyMenuLink(), and MenuTest\moveMenuLink().

Here is the call graph for this function:

Here is the caller graph for this function:

initializeTranslation (   $langcode)
protected

Instantiates a translation object for an existing translation.

The translated entity will be a clone of the current entity with the specified $langcode. All translations share the same field data structures to ensure that all of them deal with fresh data.

Parameters
string$langcodeThe language code for the requested translation.
Returns
The translation object. The content properties of the translation object are stored as references to the main entity.

Referenced by ContentEntityBase\getTranslation().

Here is the caller graph for this function:

isDefaultRevision (   $new_value = NULL)

{Checks if this entity is the default revision.

Parameters
bool$new_value(optional) A Boolean to (re)set the isDefaultRevision flag.
Returns
bool TRUE if the entity is the default revision, FALSE otherwise. If $new_value was passed, the previous value is returned.
}

Implements RevisionableInterface.

Referenced by Node\postSave().

Here is the caller graph for this function:

isDefaultTranslation ( )

{Checks whether the translation is the default one.

Returns
bool TRUE if the translation is the default one, FALSE otherwise.
}

Implements TranslatableInterface.

References LanguageInterface\LANGCODE_DEFAULT.

Referenced by ContentEntityBase\onChange().

Here is the caller graph for this function:

isNewRevision ( )

{Determines whether a new revision should be created on save.

Returns
bool TRUE if a new revision should be created.
See Also
::setNewRevision()
}

Implements RevisionableInterface.

References Entity\getEntityType(), and ContentEntityBase\getRevisionId().

Referenced by Node\preSaveRevision(), and BlockContent\preSaveRevision().

Here is the call graph for this function:

Here is the caller graph for this function:

isNewTranslation ( )

{Checks whether the translation is new.

Returns
bool TRUE if the translation is new, FALSE otherwise.
}

Implements TranslatableInterface.

isRevisionTranslationAffected ( )

{Checks whether the current translation is affected by the current revision.

Returns
bool TRUE if the entity object is affected by the current revision, FALSE otherwise.
}

Implements ContentEntityInterface.

References ContentEntityBase\hasField().

Here is the call graph for this function:

isTranslatable ( )

{Returns the translation support status.

Returns
bool TRUE if the object has translation support enabled.
}

Implements TranslatableInterface.

References ContentEntityBase\bundle(), Entity\entityManager(), ContentEntityBase\getUntranslated(), and Entity\languageManager().

Referenced by ContentEntityBase\__construct().

Here is the call graph for this function:

Here is the caller graph for this function:

isValidationRequired ( )

{Checks whether entity validation is required before saving the entity.

Returns
bool TRUE if validation is required, FALSE if not.
}

Implements FieldableEntityInterface.

label ( )

{Gets the label of the entity.

Returns
string|null The label of the entity, or NULL if there is no label defined.
}

Implements EntityInterface.

Referenced by Term\getName().

Here is the caller graph for this function:

language ( )

{Gets the language of the entity.

Returns
The language object.
}

Implements EntityInterface.

References ContentEntityBase\getLanguages(), and LanguageInterface\LANGCODE_DEFAULT.

Here is the call graph for this function:

onChange (   $name)

{Reacts to changes to a field.Note that this is invoked after any changes have been applied.

Parameters
string$field_nameThe name of the field which is changed.
Exceptions
\InvalidArgumentExceptionWhen trying to assign a value to the language field that matches an existing translation.
\LogicExceptionWhen trying to change:
  • The language of a translation.
  • The value of the flag identifying the default translation object.
}

Implements FieldableEntityInterface.

References SafeMarkup\format(), Entity\getEntityType(), ContentEntityBase\isDefaultTranslation(), ContentEntityBase\setDefaultLangcode(), and ContentEntityBase\updateFieldLangcodes().

Here is the call graph for this function:

postCreate ( EntityStorageInterface  $storage)

{Acts on an entity after it is created but before hooks are invoked.

Parameters
\Drupal\Core\Entity\EntityStorageInterface$storageThe entity storage object.
}

Implements EntityInterface.

preSave ( EntityStorageInterface  $storage)

{Acts on an entity before the presave hook is invoked.Used before the entity is saved and before invoking the presave hook. Note that in case of translatable content entities this callback is only fired on their current translation. It is up to the developer to iterate over all translations if needed. This is different from its counterpart in the Field API, FieldItemListInterface::preSave(), which is fired on all field translations automatically.

Todo:
Adjust existing implementations and the documentation according to https://www.drupal.org/node/2577609 to have a consistent API.
Parameters
\Drupal\Core\Entity\EntityStorageInterface$storageThe entity storage object.
See Also
::preSave()
}

Implements EntityInterface.

preSaveRevision ( EntityStorageInterface  $storage,
\stdClass  $record 
)

{Acts on a revision before it gets saved.

Parameters
EntityStorageInterface$storageThe entity storage object.
\stdClass$recordThe revision object.
}

Implements RevisionableInterface.

referencedEntities ( )

{Gets a list of entities referenced by this entity.

Returns
[] An array of entities.
}

Implements EntityInterface.

References DataReferenceBase\getValue().

Here is the call graph for this function:

removeTranslation (   $langcode)

{Removes the translation identified by the given language code.

Parameters
string$langcodeThe language code identifying the translation to be removed.
}

Implements TranslatableInterface.

References ContentEntityBase\getFieldDefinitions(), and LanguageInterface\LANGCODE_DEFAULT.

Here is the call graph for this function:

set (   $name,
  $value,
  $notify = TRUE 
)

{Sets a field value.

Parameters
string$field_nameThe name of the field to set; e.g., 'title' or 'name'.
mixed$valueThe value to set, or NULL to unset the field.
bool$notify(optional) Whether to notify the entity of the change. Defaults to TRUE. If the update stems from the entity, set it to FALSE to avoid being notified again.
Returns
$this
Exceptions
\InvalidArgumentExceptionIf the specified field does not exist.
}

Implements FieldableEntityInterface.

Referenced by User\addRole(), User\removeRole(), Item\setAuthor(), Comment\setAuthorName(), Message\setCopySender(), Node\setCreatedTime(), Comment\setCreatedTime(), Item\setDescription(), Term\setDescription(), Feed\setDescription(), Feed\setEtag(), Item\setFeedId(), Comment\setFieldName(), Item\setGuid(), Feed\setHash(), Comment\setHomepage(), Comment\setHostname(), Feed\setImage(), BlockContent\setInfo(), Feed\setLastCheckedTime(), Feed\setLastModified(), Item\setLink(), Message\setMessage(), EntityTest\setName(), Term\setName(), ContentEntityBase\setNewRevision(), File\setOwner(), EntityTest\setOwner(), Node\setOwner(), Comment\setOwner(), File\setOwnerId(), EntityTest\setOwnerId(), Node\setOwnerId(), Comment\setOwnerId(), Item\setPostedTime(), Node\setPromoted(), Node\setPublished(), Comment\setPublished(), Feed\setQueuedTime(), Feed\setRefreshRate(), MenuLinkContent\setRequiresRediscovery(), Node\setRevisionAuthorId(), Node\setRevisionCreationTime(), BlockContent\setRevisionLog(), ContentEntityBase\setRevisionTranslationAffected(), Message\setSenderMail(), Message\setSenderName(), Node\setSticky(), Message\setSubject(), Comment\setSubject(), Comment\setThread(), Shortcut\setTitle(), Item\setTitle(), Node\setTitle(), Feed\setTitle(), Feed\setUrl(), User\setUsername(), Feed\setWebsiteUrl(), Shortcut\setWeight(), and Term\setWeight().

setDefaultLangcode ( )
protected

Populates the local cache for the default language code.

References ContentEntityBase\hasField(), LanguageInterface\LANGCODE_DEFAULT, LanguageInterface\LANGCODE_NOT_SPECIFIED, and Entity\languageManager().

Referenced by ContentEntityBase\__construct(), and ContentEntityBase\onChange().

Here is the call graph for this function:

Here is the caller graph for this function:

setNewRevision (   $value = TRUE)

{Enforces an entity to be saved as a new revision.

Parameters
bool$value(optional) Whether a new revision should be saved.
Exceptions
\LogicExceptionThrown if the entity does not support revisions.
See Also
::isNewRevision()
}

Implements RevisionableInterface.

References Entity\getEntityType(), ContentEntityBase\getTranslation(), ContentEntityBase\hasTranslation(), and ContentEntityBase\set().

Here is the call graph for this function:

setRevisionTranslationAffected (   $affected)

{Marks the current revision translation as affected.

Parameters
bool | null$affectedThe flag value. A NULL value can be specified to reset the current value and make sure a new value will be computed by the system.
Returns
$this
}

Implements ContentEntityInterface.

References ContentEntityBase\hasField(), and ContentEntityBase\set().

Here is the call graph for this function:

setValidationRequired (   $required)

{Sets whether entity validation is required before saving the entity.

Parameters
bool$requiredTRUE if validation is required, FALSE otherwise.
Returns
$this
}

Implements FieldableEntityInterface.

toArray ( )

{Gets an array of all property values.

Returns
mixed[] An array of property values, keyed by property name.
}

Implements EntityInterface.

References ContentEntityBase\getFields().

Here is the call graph for this function:

updateFieldLangcodes (   $langcode)
protected

Updates language for already instantiated fields.

References LanguageInterface\LANGCODE_DEFAULT.

Referenced by ContentEntityBase\onChange().

Here is the caller graph for this function:

updateOriginalValues ( )

Updates the original values with the interim changes.

References ContentEntityBase\getFieldDefinitions().

Here is the call graph for this function:

uuid ( )

{Gets the entity UUID (Universally Unique Identifier).The UUID is guaranteed to be unique and can be used to identify an entity across multiple systems.

Returns
string|null The UUID of the entity, or NULL if the entity does not have one.
}

Implements EntityInterface.

References ContentEntityBase\getEntityKey().

Referenced by BlockContent\getInstances(), and MenuLinkContent\getPluginId().

Here is the call graph for this function:

Here is the caller graph for this function:

validate ( )

{Validates the currently set values.

Returns
A list of constraint violations. If the list is empty, validation succeeded.
}

Implements FieldableEntityInterface.

References Entity\getTypedData().

Here is the call graph for this function:

Field Documentation

const TRANSLATION_CREATED = 2

Status code identifying a newly created translation.

const TRANSLATION_EXISTING = 1

Status code identifying an existing translation.

const TRANSLATION_REMOVED = 0

Status code identifying a removed translation.


The documentation for this class was generated from the following file: