Skip to content

Instantly share code, notes, and snippets.

@alex-kirienko
Last active February 29, 2016 15:01
Show Gist options
  • Save alex-kirienko/8377a3c7594e9913f736 to your computer and use it in GitHub Desktop.
Save alex-kirienko/8377a3c7594e9913f736 to your computer and use it in GitHub Desktop.
<?php
function build_some_render_array($field) {
$build = array(); // Drupal render array
// more stuff happens here
$entity = $field['entity'];
$entity_wrapper = entity_metadata_wrapper('node', $entity);
try {
$value = $entity_wrapper->field_some_name->value();
// more code
return $result;
}
catch (Exception $e) {
// do nothing
}
return drupal_render($build);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment