public function ContentEntityBase::get in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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
7 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 453 - Contains \Drupal\Core\Entity\ContentEntityBase.
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];
}