public function ContentEntityBase::get in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::get()
- 10 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::get()
Gets a field item list.
Parameters
string $field_name: The name of the field to get; e.g., 'title' or 'name'.
Return value
\Drupal\Core\Field\FieldItemListInterface The field item list, containing the field items.
Throws
\InvalidArgumentException If an invalid field name is given.
Overrides FieldableEntityInterface::get
8 calls to ContentEntityBase::get()
- Comment::getThread in core/
modules/ comment/ src/ Entity/ Comment.php - Returns the alphadecimal representation of the comment's place in a thread.
- ContentEntityBase::getFields in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - Gets an array of all field item lists.
- ContentEntityBase::getTranslatableFields in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - Gets an array of field item lists for translatable fields.
- ContentEntityBase::onChange in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - Reacts to changes to a field.
- ContentEntityBase::setDefaultLangcode in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - Populates the local cache for the default language code.
File
- core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php, line 566
Class
- ContentEntityBase
- Implements Entity Field API specific enhancements to the Entity class.
Namespace
Drupal\Core\EntityCode
public function get($field_name) {
if (!isset($this->fields[$field_name][$this->activeLangcode])) {
return $this
->getTranslatedField($field_name, $this->activeLangcode);
}
return $this->fields[$field_name][$this->activeLangcode];
}