public ContentEntityBase::get($field_name)
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
File
- core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 450
Class
- ContentEntityBase
- Implements Entity Field API specific enhancements to the Entity class.
Namespace
Drupal\Core\Entity
Code
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]; }
Please login to continue.