public function EntityStructureWrapper::get in Entity API 7
Get the wrapper for a property.
Return value
EntityMetadataWrapper An instance of EntityMetadataWrapper.
1 call to EntityStructureWrapper::get()
- EntityStructureWrapper::__get in includes/
entity.wrapper.inc - Magic method: Get a wrapper for a property.
File
- includes/
entity.wrapper.inc, line 414 - Provides wrappers allowing easy usage of the entity metadata.
Class
- EntityStructureWrapper
- Provides a general wrapper for any data structure. For this to work the metadata has to be passed during construction.
Code
public function get($name) {
// Look it up in the cache if possible.
if (!array_key_exists($name, $this->cache)) {
if ($info = $this
->getPropertyInfo($name)) {
$info += array(
'parent' => $this,
'name' => $name,
'langcode' => $this->langcode,
'property defaults' => array(),
);
$info['property defaults'] += $this->info['property defaults'];
$this->cache[$name] = entity_metadata_wrapper($info['type'], NULL, $info);
}
else {
throw new EntityMetadataWrapperException('There is no property ' . check_plain($name) . " for this entity.");
}
}
return $this->cache[$name];
}