Skip to content

Instantly share code, notes, and snippets.

@wimleers
Created April 9, 2013 15:08
Show Gist options
  • Save wimleers/5346477 to your computer and use it in GitHub Desktop.
Save wimleers/5346477 to your computer and use it in GitHub Desktop.
/**
* Implements hook_entity_view_alter().
*/
function edit_entity_view_alter(&$build, EntityInterface $entity, EntityDisplay $display) {
$build['#attributes']['data-edit-entity'] = $entity->entityType() . '/' . $entity->id();
}
// /**
// * Implements hook_preprocess_HOOK() for node.tpl.php.
// *
// * @todo Move towards hook_preprocess_entity() once that's available.
// */
// function edit_preprocess_node(&$variables) {
// $node = $variables['elements']['#node'];
// $variables['attributes']['data-edit-entity'] = 'node/' . $node->nid;
// }
// /**
// * Implements hook_preprocess_HOOK() for taxonomy-term.tpl.php.
// *
// * @todo Move towards hook_preprocess_entity() once that's available.
// */
// function edit_preprocess_taxonomy_term(&$variables) {
// $term = $variables['elements']['#term'];
// $variables['attributes']['data-edit-entity'] = 'taxonomy_term/' . $term->id();
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment