Skip to content
Snippets Groups Projects
Commit 1233dfeb authored by Tim Steiner's avatar Tim Steiner
Browse files

[gh-190] Merging from testing into staging

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@912 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent f6ece8bd
No related merge requests found
[#897] Upgrade Workbench Moderation to 2011-07-15 7.x-1.x-dev version
* r857
* This was done to address broken Unpublishing in 7.x-1.0-beta7
* If future releases don't include the fix (not likely) patches will be needed from http://drupal.org/node/1206694
-----------------------------------
[#911] Upgrade Workbench Moderation to 7.x-1.0-beta8 + trigger support
* Trigger support not in beta8
* http://drupal.org/files/issues/trigger_support_for_wb_moderation-1079134-10.patch
* from http://drupal.org/node/1079134
* Don't upgrade WB Moderation without first applying this patch unless the new version supports Triggers
\ No newline at end of file
......@@ -13,9 +13,9 @@ files[] = includes/workbench_moderation_handler_filter_user_can_moderate.inc
files[] = tests/workbench_moderation.test
files[] = tests/workbench_moderation.files.test
; Information added by drupal.org packaging script on 2011-07-15
version = "7.x-1.x-dev"
; Information added by drupal.org packaging script on 2011-07-23
version = "7.x-1.0-beta8"
core = "7.x"
project = "workbench_moderation"
datestamp = "1310691021"
datestamp = "1311431220"
......@@ -1421,6 +1421,9 @@ function workbench_moderation_moderate($node, $state) {
if (!empty($node->workbench_moderation['published'])) {
drupal_register_shutdown_function('workbench_moderation_store', $node);
}
/** UNL CHANGE/ADDITION - SEE workbench_moderation/README-UNL.txt **/
workbench_moderation_trigger_transition($node, $old_revision->state, $state);
}
/**
......@@ -1791,3 +1794,69 @@ function workbench_moderation_workbench_block() {
return $output;
}
/** UNL CHANGE/ADDITION - SEE workbench_moderation/README-UNL.txt **/
/**
* Implements hook_trigger_info().
*
* Creates a trigger for each transition.
*/
function workbench_moderation_trigger_info() {
$output = array(
'workbench_moderation' => array(
'workbench_moderation_transition' => array(
'label' => t('After any transition between states occurs.'),
),
),
);
// Get all transitions.
$transitions = workbench_moderation_transitions();
// Add a trigger for each trasnistion.
foreach ($transitions as $transition_definition) {
$transition_string = 'wmt_' . $transition_definition->from_name . '__' . $transition_definition->to_name;
$output['workbench_moderation'][$transition_string] = array(
'label' => t('Transition from the state %from_name to %to_name occurs.', array('%from_name' => $transition_definition->from_name, '%to_name' => $transition_definition->to_name)),
);
}
return $output;
}
/**
* transition trigger: Run actions associated with an arbitrary event.
*
* This function is executed after a transition takes place.
*
* @param $node
* The node undergoing the transition.
* @param $from_state
* The previous workbench moderation state.
* @param $state
* The new workbench moderation state.
*/
function workbench_moderation_trigger_transition($node, $from_state, $state, $a3 = NULL, $a4 = NULL) {
// Ask the trigger module for all actions enqueued for the 'transition' trigger.
$aids = trigger_get_assigned_actions('workbench_moderation_transition');
// prepare a basic context, indicating group and "hook", and call all the
// actions with this context as arguments.
$context = array(
'group' => 'workbench_moderation',
'hook' => 'transition',
'from_state' => $from_state,
'state' => $state,
);
actions_do(array_keys($aids), $node, $context, $a3, $a4);
// Ask the trigger module for all actions enqueued for this specific transition.
$transition_string = 'wmt_' . $from_state . '__' . $state;
$aids = trigger_get_assigned_actions($transition_string);
$context['hook'] = $transition_string;
actions_do(array_keys($aids), $node, $context, $a3, $a4);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment