public function ContentEntityBase::get in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::get()
 - 9 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
60 calls to ContentEntityBase::get()
- BlockContent::getRevisionCreationTime in core/
modules/ block_content/ src/ Entity/ BlockContent.php  - Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionCreationTime().
 - BlockContent::getRevisionLogMessage in core/
modules/ block_content/ src/ Entity/ BlockContent.php  - Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionLogMessage().
 - BlockContent::getRevisionUser in core/
modules/ block_content/ src/ Entity/ BlockContent.php  - Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionUser().
 - BlockContent::getRevisionUserId in core/
modules/ block_content/ src/ Entity/ BlockContent.php  - Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionUserId().
 - BlockContent::isReusable in core/
modules/ block_content/ src/ Entity/ BlockContent.php  - Determines if the block is reusable or not.
 
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];
}