FieldItemBase::__get

public FieldItemBase::__get($name)

Magic method: Gets a property value.

Parameters

$property_name: The name of the property to get; e.g., 'title' or 'name'.

Return value

\Drupal\Core\TypedData\TypedDataInterface The property object.

Throws

\InvalidArgumentException If a not existing property is accessed.

Overrides FieldItemInterface::__get

File

core/lib/Drupal/Core/Field/FieldItemBase.php, line 136

Class

FieldItemBase
An entity field item.

Namespace

Drupal\Core\Field

Code

public function __get($name) {
  // There is either a property object or a plain value - possibly for a
  // not-defined property. If we have a plain value, directly return it.
  if (isset($this->properties[$name])) {
    return $this->properties[$name]->getValue();
  }
  elseif (isset($this->values[$name])) {
    return $this->values[$name];
  }
}
doc_Drupal
2016-10-29 09:11:40
Comments
Leave a Comment

Please login to continue.