ContentEntityBase::setNewRevision

public ContentEntityBase::setNewRevision($value = TRUE) Enforces an entity to be saved as a new revision. Parameters bool $value: (optional) Whether a new revision should be saved. Throws \LogicException Thrown if the entity does not support revisions. Overrides RevisionableInterface::setNewRevision See also \Drupal\Core\Entity\EntityInterface::isNewRevision() File core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 261 Class ContentEntityBase Implements Entity Field API specific en

ContentEntityBase::setDefaultLangcode

protected ContentEntityBase::setDefaultLangcode() Populates the local cache for the default language code. File core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 621 Class ContentEntityBase Implements Entity Field API specific enhancements to the Entity class. Namespace Drupal\Core\Entity Code protected function setDefaultLangcode() { // Get the language code if the property exists. // Try to read the value directly from the list of entity keys which got // initialized in _

ContentEntityBase::set

public ContentEntityBase::set($name, $value, $notify = TRUE) Sets a field value. Parameters string $field_name: The name of the field to set; e.g., 'title' or 'name'. mixed $value: The 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. Return value $this Throws \InvalidArgumentException If the specified field does not exist. Overrid

ContentEntityBase::removeTranslation

public ContentEntityBase::removeTranslation($langcode) Removes the translation identified by the given language code. Parameters string $langcode: The language code identifying the translation to be removed. Overrides TranslatableInterface::removeTranslation File core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 839 Class ContentEntityBase Implements Entity Field API specific enhancements to the Entity class. Namespace Drupal\Core\Entity Code public function removeTranslation($l

ContentEntityBase::referencedEntities

public ContentEntityBase::referencedEntities() Gets a list of entities referenced by this entity. Return value \Drupal\Core\Entity\EntityInterface[] An array of entities. Overrides Entity::referencedEntities File core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 1061 Class ContentEntityBase Implements Entity Field API specific enhancements to the Entity class. Namespace Drupal\Core\Entity Code public function referencedEntities() { $referenced_entities = array(); // Gather

ContentEntityBase::preSaveRevision

public ContentEntityBase::preSaveRevision(EntityStorageInterface $storage, \stdClass $record) Acts on a revision before it gets saved. Parameters EntityStorageInterface $storage: The entity storage object. \stdClass $record: The revision object. Overrides RevisionableInterface::preSaveRevision File core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 365 Class ContentEntityBase Implements Entity Field API specific enhancements to the Entity class. Namespace Drupal\Core\Entity Code

ContentEntityBase::preSave

public ContentEntityBase::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 translati

ContentEntityBase::postCreate

public ContentEntityBase::postCreate(EntityStorageInterface $storage) Acts on a created entity before hooks are invoked. Used after the entity is created, but before saving the entity and before any of the presave hooks are invoked. See the Entity CRUD topic for more information. Parameters \Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object. Overrides Entity::postCreate See also \Drupal\Core\Entity\EntityInterface::create() File core/lib/Drupal/Core/Entity/ContentE

ContentEntityBase::onChange

public ContentEntityBase::onChange($name) Reacts to changes to a field. Note that this is invoked after any changes have been applied. Parameters string $field_name: The name of the field which is changed. Throws \InvalidArgumentException When trying to assign a value to the language field that matches an existing translation. \LogicException When trying to change: The language of a translation. The value of the flag identifying the default translation object. Overrides FieldableEntityInter

ContentEntityBase::language

public ContentEntityBase::language() Gets the language of the entity. Return value \Drupal\Core\Language\LanguageInterface The language object. Overrides Entity::language File core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 599 Class ContentEntityBase Implements Entity Field API specific enhancements to the Entity class. Namespace Drupal\Core\Entity Code public function language() { $language = NULL; if ($this->activeLangcode != LanguageInterface::LANGCODE_DEFAULT) {