public ModerationHandler::onBundleModerationConfigurationFormSubmit(ConfigEntityInterface $bundle)
Operates on the bundle definition that has been marked as moderated.
Note: The values on the EntityModerationForm itself are already saved so do not need to be saved here. If any changes are made to the bundle object here it is this method's responsibility to call save() on it.
The most common use case is to force revisions on for this bundle if moderation is enabled. That, sadly, does not have a common API in core.
Parameters
\Drupal\Core\Config\Entity\ConfigEntityInterface $bundle: The bundle definition that is being saved.
Overrides ModerationHandlerInterface::onBundleModerationConfigurationFormSubmit
File
- core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php, line 41
Class
- ModerationHandler
- Common customizations for most/all entities.
Namespace
Drupal\content_moderation\Entity\Handler
Code
public function onBundleModerationConfigurationFormSubmit(ConfigEntityInterface $bundle) { // The Revisions portion of Entity API is not uniformly applied or // consistent. Until that's fixed, we'll make a best-attempt to apply it to // the common entity patterns so as to avoid every entity type needing to // implement this method, although some will still need to do so for now. // This is the API that should be universal, but isn't yet. // @see \Drupal\node\Entity\NodeType if (method_exists($bundle, 'setNewRevision')) { $bundle->setNewRevision(TRUE); } // This is the raw property used by NodeType, and likely others. elseif ($bundle->get('new_revision') !== NULL) { $bundle->set('new_revision', TRUE); } // This is the raw property used by BlockContentType, and maybe others. elseif ($bundle->get('revision') !== NULL) { $bundle->set('revision', TRUE); } $bundle->save(); }
Please login to continue.