function ContentEntityBase::get

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::get()
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::get()
  3. 10 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::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
ContentEntityBase::getTranslatableFields in core/lib/Drupal/Core/Entity/ContentEntityBase.php
ContentEntityBase::onChange in core/lib/Drupal/Core/Entity/ContentEntityBase.php
ContentEntityBase::setDefaultLangcode in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Populates the local cache for the default language code.

... See full list

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 595

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];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.