Cover by Sammy Spets

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Structure fields

Now that we've successfully distinguished single-value and multi-value fields, we have to get around one last, very nasty trap before we can cook code with wrapped fields. The trap: some fields are neither lists of values nor just values. For these fields we can't use the value() method directly and have to resort to other means. We will call these types of fields structure fields.

Structure field wrappers are either of the EntityDrupalWrapper class or the EntityStructureWrapper class. The former class means that the field wrapper is wrapping an entity. In our example, code for printing EntityDrupalWrapper values would look as follows:

function pde_entity_value($entity_wrapper) { return pde_output($entity_wrapper->label()); } ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required