You are here

function drafty_entity_update in Drafty 7

Implements hook_entity_update().

File

./drafty.module, line 68
Hook implementations and API functions for the Drafty module.

Code

function drafty_entity_update($entity, $type) {
  $recursion_level =& drupal_static('drafty_recursion_level', 0);
  if ($recursion_level == 1) {

    // Doing this in hook_entity_update() so that the entire process is
    // completed within entity saving. However this results in two entity saves
    // within entity insert. The other option is hook_exit(), which is not
    // better since for example that would happen outside the transaction.
    drafty()
      ->restorePublishedRevisions();
  }
  $recursion_level--;
}