diff --git a/includes/entity.wrapper.inc b/includes/entity.wrapper.inc index 3c36a54..320ae51 100644 --- a/includes/entity.wrapper.inc +++ b/includes/entity.wrapper.inc @@ -115,18 +115,19 @@ abstract class EntityMetadataWrapper { } /** - * Returns whether data is available to work with. + * Determines if a given property exists and has a value. * - * Exposes the EntityMetadataWrapper::dataAvailable() method result. + * @param $name + * The name of the property whose value might be empty. * - * @return - * If we operate without any data TRUE, else FALSE. + * @return bool + * TRUE if 'name' is not a property, or if it's empty, otherwise FALSE. * * @see EntityMetadataWrapper::dataAvailable() */ - public function isEmpty() { + public function isEmpty($name) { try { - $value = $this->value(); + $value = $this->$name->value(); } catch (EntityMetadataWrapperException $e) { $value = FALSE; @@ -441,24 +442,6 @@ class EntityStructureWrapper extends EntityMetadataWrapper implements IteratorAg } /** - * Safely checks if the given property exists. - * - * @param $name - * The name of the child to check. - * @return bool - * TRUE if the child exists, FALSE if it does not. - */ - public function hasProperty($name) { - try { - $this->getPropertyInfo($name); - return TRUE; - } - catch (EntityMetadataWrapperException $e) { - return FALSE; - } - } - - /** * Magic method: Get a wrapper for a property. */ public function __get($name) {