You are here

public function EntityDrupalWrapper::value in Entity API 7

Overridden.

Parameters

$options: An array of options. Known keys:

  • identifier: If set to TRUE, the entity identifier is returned.

Overrides EntityMetadataWrapper::value

8 calls to EntityDrupalWrapper::value()
EntityDrupalWrapper::delete in includes/entity.wrapper.inc
Permanently delete the wrapped entity.
EntityDrupalWrapper::entityAccess in includes/entity.wrapper.inc
Checks whether the operation $op is allowed on the entity.
EntityDrupalWrapper::getIdentifier in includes/entity.wrapper.inc
Returns the identifier of the wrapped entity.
EntityDrupalWrapper::label in includes/entity.wrapper.inc
Returns the entity label.
EntityDrupalWrapper::spotBundleInfo in includes/entity.wrapper.inc
Tries to determine the bundle and adds in the according property info.

... See full list

File

includes/entity.wrapper.inc, line 731
Provides wrappers allowing easy usage of the entity metadata.

Class

EntityDrupalWrapper
Provides a wrapper for entities registrered in hook_entity_info().

Code

public function value(array $options = array()) {

  // Try loading the data via the getter callback if there is none yet.
  if (!isset($this->data)) {
    $this
      ->setEntity(parent::value());
  }
  if (!empty($options['identifier'])) {
    return $this->id;
  }
  elseif (!$this->data && !empty($this->id)) {

    // Lazy load the entity if necessary.
    $return = entity_load($this->type, array(
      $this->id,
    ));

    // In case the entity cannot be loaded, we return NULL just as for empty
    // properties.
    $this->data = $return ? reset($return) : NULL;
  }
  return $this->data;
}