function workbench_moderation_trigger_info in Workbench Moderation 7
Same name and namespace in other branches
- 7.3 workbench_moderation.module \workbench_moderation_trigger_info()
Implements hook_trigger_info().
Creates a trigger for each transition.
File
- ./
workbench_moderation.module, line 2197 - Content moderation for Workbench.
Code
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 transition.
foreach ($transitions as $transition_definition) {
$transition_string = 'wmt_' . $transition_definition->from_name . '__' . $transition_definition->to_name;
// Hash this string if it's longer than the db field size
if (strlen($transition_string) > 32) {
$transition_string = md5($transition_string);
}
$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;
}