content_moderation_action_info_alter

content_moderation_action_info_alter(&$definitions)

Implements hook_action_info_alter().

File

core/modules/content_moderation/content_moderation.module, line 212
Contains content_moderation.module.

Code

function content_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;
  }
}
doc_Drupal
2016-10-29 08:58:32
Comments
Leave a Comment

Please login to continue.