From 3bd9f365cf530b91d354baaf2895b6456be55d77 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 17 Jan 2017 14:07:19 +0000 Subject: [PATCH] Issue #2842040 by Alan-H, timmillwood: Remove unused code from Content Moderation handlers --- .../src/Entity/Handler/ModerationHandler.php | 26 ------------------- .../Handler/ModerationHandlerInterface.php | 16 ------------ 2 files changed, 42 deletions(-) diff --git a/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php b/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php index 9d89253ce5e..542cc845acd 100644 --- a/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php +++ b/core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php @@ -2,7 +2,6 @@ namespace Drupal\content_moderation\Entity\Handler; -use Drupal\Core\Config\Entity\ConfigEntityInterface; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\EntityHandlerInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -35,31 +34,6 @@ class ModerationHandler implements ModerationHandlerInterface, EntityHandlerInte $entity->isDefaultRevision($default_revision); } - /** - * {@inheritdoc} - */ - 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(); - } - /** * {@inheritdoc} */ diff --git a/core/modules/content_moderation/src/Entity/Handler/ModerationHandlerInterface.php b/core/modules/content_moderation/src/Entity/Handler/ModerationHandlerInterface.php index c3d6ddd710a..976fbb29da2 100644 --- a/core/modules/content_moderation/src/Entity/Handler/ModerationHandlerInterface.php +++ b/core/modules/content_moderation/src/Entity/Handler/ModerationHandlerInterface.php @@ -2,7 +2,6 @@ namespace Drupal\content_moderation\Entity\Handler; -use Drupal\Core\Config\Entity\ConfigEntityInterface; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Form\FormStateInterface; @@ -27,21 +26,6 @@ interface ModerationHandlerInterface { */ public function onPresave(ContentEntityInterface $entity, $default_revision, $published_state); - /** - * 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. - * - * @param \Drupal\Core\Config\Entity\ConfigEntityInterface $bundle - * The bundle definition that is being saved. - */ - public function onBundleModerationConfigurationFormSubmit(ConfigEntityInterface $bundle); - /** * Alters entity forms to enforce revision handling. *