function content_moderation_action_info_alter
Same name in other branches
- 9 core/modules/content_moderation/content_moderation.module \content_moderation_action_info_alter()
- 10 core/modules/content_moderation/content_moderation.module \content_moderation_action_info_alter()
- 11.x core/modules/content_moderation/content_moderation.module \content_moderation_action_info_alter()
Implements hook_action_info_alter().
File
-
core/
modules/ content_moderation/ content_moderation.module, line 346
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 entity. If another module has already swapped out those classes,
// though, we'll be polite and do nothing.
foreach ($definitions as &$definition) {
if ($definition['id'] === 'entity:publish_action' && $definition['class'] == PublishAction::class) {
$definition['class'] = ModerationOptOutPublish::class;
}
if ($definition['id'] === 'entity:unpublish_action' && $definition['class'] == UnpublishAction::class) {
$definition['class'] = ModerationOptOutUnpublish::class;
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.