You are here

public function PluginCollectionItemBase::__get in Plugin 8.2

Magic method: Gets a property value.

Parameters

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

Return value

mixed The property value.

Throws

\InvalidArgumentException If a not existing property is accessed.

Overrides FieldItemBase::__get

File

src/Plugin/Field/FieldType/PluginCollectionItemBase.php, line 21

Class

PluginCollectionItemBase
Provides a base for plugin collection field items.

Namespace

Drupal\plugin\Plugin\Field\FieldType

Code

public function __get($name) {

  // @todo Remove this override once https://www.drupal.org/node/2413471 has
  //   been fixed.
  // 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 ($this->definition
    ->getPropertyDefinition($name)) {
    return $this
      ->get($name)
      ->getValue();
  }
  elseif (isset($this->values[$name])) {
    return $this->values[$name];
  }
}