X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fchi-teck%2Fdrupal-code-generator%2Ftemplates%2Fd7%2Fhook%2Fentity_update.twig;fp=vendor%2Fchi-teck%2Fdrupal-code-generator%2Ftemplates%2Fd7%2Fhook%2Fentity_update.twig;h=7b32e3ad51512da4bdb46e3d1c9f018a7c4a419a;hp=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_update.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_update.twig new file mode 100644 index 000000000..7b32e3ad5 --- /dev/null +++ b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_update.twig @@ -0,0 +1,15 @@ +/** + * Implements hook_entity_update(). + */ +function {{ machine_name }}_entity_update($entity, $type) { + // Update the entity's entry in a fictional table of all entities. + $info = entity_get_info($type); + list($id) = entity_extract_ids($type, $entity); + db_update('example_entity') + ->fields(array( + 'updated' => REQUEST_TIME, + )) + ->condition('type', $type) + ->condition('id', $id) + ->execute(); +}