I am writing a few views_handler_field subclasses that render fields of my entity depending on other values of the entity. The examples I see use a very awkward way of accessing the other field data, eg.

function render($values) {
  if (isset($values->field_name[0])) {
    $my_stuff = $values->field_name[0]['raw']['value'];

Is there a clean way of accessing other fields in the entity, like EntityMetadataWrapper? I would just load the entity and create a EMW instance but that seems expensive to do for each cell in a big table.


field_get_items() and field_view_value() are as clean as it gets without Entity API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.