Nancy, I tend to do the following (using body as an example) in pseudo standard data import script.
$body = $wrapper->body->value(); if (empty($body)) { // Do something, for example set a value to avoid Undefined variable notices $wrapper->body->set(array('value' => '')); } // Now I can deal with the data as if it were populated. if ($wrapper->body->value->raw() != $this->Body) { $wrapper->body->set(array('value' => $this->Body, 'format' => 'full_html')); }
Lucas MTech, LLC http://www.mtechinformationsolutions.com
On Mon, Aug 12, 2013 at 12:25 PM, Nancy Wichmann nan_wich@bellsouth.netwrote:
With fields I often do: if ($vca = field_get_items('node', $node, 'field_corresponding_vca')) {
This makes sure there is some data before trying to do anything with it.
But I've searched all over the place and even dug into the code. How do you do this with entity_metadata_wrapper? I want to give the users an error message that means something to them, and sometimes just set the value to zero.
I see that the Entity module has a protected function called "dataAvailable" but I can't use a protected function.
*Nancy* Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
-- [ Drupal support list | http://lists.drupal.org/ ]