function ContentEntityBase::set

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::set()
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::set()
  3. 11.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::set()
40 calls to ContentEntityBase::set()
BlockContent::setInfo in core/modules/block_content/src/Entity/BlockContent.php
Sets the block description.
BlockContent::setNonReusable in core/modules/block_content/src/Entity/BlockContent.php
Sets the block to be non-reusable.
BlockContent::setReusable in core/modules/block_content/src/Entity/BlockContent.php
Sets the block to be reusable.
Comment::preSave in core/modules/comment/src/Entity/Comment.php
Acts on an entity before the presave hook is invoked.
Comment::setAuthorName in core/modules/comment/src/Entity/Comment.php
Sets the name of the author of the comment.

... See full list

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 653

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

public function set($name, $value, $notify = TRUE) {
    // Assign the value on the child and overrule notify such that we get
    // notified to handle changes afterwards. We can ignore notify as there is
    // no parent to notify anyway.
    $this->get($name)
        ->setValue($value, TRUE);
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.