public function EntityNG::__get

Magic getter: Gets the property in default language.

For compatibility mode to work this must return a reference.

File

drupal/core/lib/Drupal/Core/Entity/EntityNG.php, line 320
Definition of Drupal\Core\Entity\EntityNG.

Class

EntityNG
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

public function &__get($name) {
  if ($this->compatibilityMode) {
    if (!isset($this->values[$name])) {
      $this->values[$name] = NULL;
    }
    return $this->values[$name];
  }
  if (isset($this->fields[$name][LANGUAGE_DEFAULT])) {
    return $this->fields[$name][LANGUAGE_DEFAULT];
  }
  if ($this
    ->getPropertyDefinition($name)) {
    $return = $this
      ->get($name);
    return $return;
  }
  if (!isset($this->{$name})) {
    $this->{$name} = NULL;
  }
  return $this->{$name};
}