function workbench_moderation_state_delete in Workbench Moderation 7
Same name and namespace in other branches
- 7.3 workbench_moderation.module \workbench_moderation_state_delete()
Delete a moderation state.
This function also deletes any transitions that reference the deleted moderation state.
Invokes hook_workbench_moderation_state_delete().
Parameters
$state: An object with at least a name property.
See also
hook_workbench_moderation_state_delete().
hook_workbench_moderation_transition_delete().
1 call to workbench_moderation_state_delete()
- workbench_moderation_admin_states_form_submit in ./
workbench_moderation.admin.inc - Form submit handler for moderation state administration.
File
- ./
workbench_moderation.module, line 1458 - Content moderation for Workbench.
Code
function workbench_moderation_state_delete($state) {
foreach (module_implements('workbench_moderation_state_delete') as $module) {
// Don't call this function! That would lead to infinite recursion.
if ($module !== 'workbench_moderation') {
module_invoke($module, 'workbench_moderation_state_delete', $state);
}
}
db_delete('workbench_moderation_states')
->condition('name', $state->name)
->execute();
// Delete related transitions, too.
$query = db_select('workbench_moderation_transitions', 't')
->fields('t')
->condition(db_or()
->condition('from_name', $state->name)
->condition('to_name', $state->name))
->execute();
while ($transition = $query
->fetchObject()) {
workbench_moderation_transition_delete($transition);
}
}