Issue #2842040 by Alan-H, timmillwood: Remove unused code from Content Moderation handlers
parent
dc583b732a
commit
3bd9f365cf
|
@ -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}
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue