function ContentModerationHooks::actionInfoAlter
Implements hook_action_info_alter().
File
-
core/
modules/ content_moderation/ src/ Hook/ ContentModerationHooks.php, line 268
Class
- ContentModerationHooks
- Hook implementations for content_moderation.
Namespace
Drupal\content_moderation\HookCode
public function actionInfoAlter(&$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.