You are here

function revisioning_publish_latest_revision_action in Revisioning 7

Same name and namespace in other branches
  1. 8 revisioning_triggers_actions.inc \revisioning_publish_latest_revision_action()
  2. 6.4 revisioning_triggers_actions.inc \revisioning_publish_latest_revision_action()
  3. 6 revisioning_triggers_actions.inc \revisioning_publish_latest_revision_action()
  4. 6.3 revisioning_triggers_actions.inc \revisioning_publish_latest_revision_action()

As declared in revisioning_action_info().

Called from actions.inc/actions_do().

Parameters

object $entity: in our case the node in question

array $context: an array with $context['hook'] telling us which trigger instigated this call, eg 'node_presave' as specified in the 'triggers' array, in hook_action_info()

File

./revisioning_triggers_actions.inc, line 210
Triggers and actions supported by the Revisioning module.

Code

function revisioning_publish_latest_revision_action(&$entity, $context = array()) {
  $node = $entity;
  $type = node_type_get_type($node->type);
  watchdog('revisioning', 'Executing publish_latest_revision action for @type %title', array(
    '@type' => $type->name,
    '%title' => $node->title,
  ), WATCHDOG_NOTICE, l(t('view'), "node/{$node->nid}"));
  if (_revisioning_publish_latest_revision($node)) {
    revisioning_set_status_message(t('Revision has been published.'));
  }
  else {
    drupal_set_message(t('"%title" has no pending revision to be published.', array(
      '%title' => $node->title,
    )), 'warning');
  }
}