You are here

function workbench_moderation_transition_save in Workbench Moderation 7

Same name and namespace in other branches
  1. 7.3 workbench_moderation.module \workbench_moderation_transition_save()

Saves a moderation state transition.

Invokes hook_workbench_moderation_transition_save().

Parameters

$transition: An object with from_name and to_name properties that reference moderation states.

Return value

int Returns MergeQuery::STATUS_INSERT or MergeQuery::STATUS_UPDATE depending on if this INSERT'ing a new transation or UPDATE'ing an existing one.

See also

hook_workbench_moderation_transition_save()

2 calls to workbench_moderation_transition_save()
workbench_moderation_admin_transitions_form_submit in ./workbench_moderation.admin.inc
Form submit handler for moderation transitions.
workbench_moderation_transitions_features_rebuild in ./workbench_moderation.features.inc
Implements COMPONENT_features_rebuild().

File

./workbench_moderation.module, line 1522
Content moderation for Workbench.

Code

function workbench_moderation_transition_save($transition) {
  $status = db_merge('workbench_moderation_transitions')
    ->key(array(
    'name' => $transition->name,
    'from_name' => $transition->from_name,
    'to_name' => $transition->to_name,
  ))
    ->fields((array) $transition)
    ->execute();
  foreach (module_implements('workbench_moderation_transition_save') as $module) {

    // Don't call this function! That would lead to infinite recursion.
    if ($module !== 'workbench_moderation') {
      module_invoke($module, 'workbench_moderation_transition_save', $transition, $status);
    }
  }
  return $status;
}