You are here

function workbench_moderation_action_info_alter in Workbench Moderation 8.2

Same name and namespace in other branches
  1. 8 workbench_moderation.module \workbench_moderation_action_info_alter()

Implements hook_action_info_alter().

File

./workbench_moderation.module, line 203
Contains workbench_moderation.module.

Code

function workbench_moderation_action_info_alter(&$definitions) {

  // The publish/unpublish actions are not valid on moderated entities. So swap
  // their implementations out for alternates that will become a no-op on a
  // moderated node. If another module has already swapped out those classes,
  // though, we'll be polite and do nothing.
  if (isset($definitions['node_publish_action']['class']) && $definitions['node_publish_action']['class'] == PublishNode::class) {
    $definitions['node_publish_action']['class'] = ModerationOptOutPublishNode::class;
  }
  if (isset($definitions['node_unpublish_action']['class']) && $definitions['node_unpublish_action']['class'] == UnpublishNode::class) {
    $definitions['node_unpublish_action']['class'] = ModerationOptOutUnpublishNode::class;
  }
}