Same name and namespace in other branches
- 8.9.x core/lib/Drupal/Core/Entity/FieldableEntityInterface.php \Drupal\Core\Entity\FieldableEntityInterface::set()
- 9 core/lib/Drupal/Core/Entity/FieldableEntityInterface.php \Drupal\Core\Entity\FieldableEntityInterface::set()
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.
31 calls to FieldableEntityInterface::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.
File
- core/
lib/ Drupal/ Core/ Entity/ FieldableEntityInterface.php, line 170
Class
- FieldableEntityInterface
- Interface for entities having fields.
Namespace
Drupal\Core\EntityCode
public function set($field_name, $value, $notify = TRUE);