[support] Entity_metadata_wrapper: Does field have data?
Nancy Wichmann
nan_wich at bellsouth.net
Mon Aug 12 20:38:54 UTC 2013
Really? When I do something like that, a body field with no data at all throws an exception. I knew it - Drupal hates me!
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
>________________________________
> From: Lucas D Hedding
>
>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'));
>}
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20130812/15cd14e4/attachment.html
More information about the support
mailing list