public function EntityNG::getPropertyDefinition

Implements ComplexDataInterface::getPropertyDefinition().

Overrides Entity::getPropertyDefinition

5 calls to EntityNG::getPropertyDefinition()
EntityNG::getTranslatedField in drupal/core/lib/Drupal/Core/Entity/EntityNG.php
Gets a translated field.
EntityNG::__get in drupal/core/lib/Drupal/Core/Entity/EntityNG.php
Magic getter: Gets the property in default language.
EntityNG::__isset in drupal/core/lib/Drupal/Core/Entity/EntityNG.php
Magic method.
EntityNG::__set in drupal/core/lib/Drupal/Core/Entity/EntityNG.php
Magic getter: Sets the property in default language.
EntityNG::__unset in drupal/core/lib/Drupal/Core/Entity/EntityNG.php
Magic method.

File

drupal/core/lib/Drupal/Core/Entity/EntityNG.php, line 146
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 getPropertyDefinition($name) {

  // First try getting property definitions which apply to all entities of
  // this type. Then if this fails add in definitions of optional properties
  // as well. That way we can use property definitions of base properties
  // when determining the optional properties of an entity.
  $definitions = entity_get_controller($this->entityType)
    ->getFieldDefinitions(array());
  if (isset($definitions[$name])) {
    return $definitions[$name];
  }

  // Add in optional properties if any.
  if ($definitions = $this
    ->getPropertyDefinitions()) {
    return isset($definitions[$name]) ? $definitions[$name] : FALSE;
  }
}