reverted: --- b/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ a/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -310,13 +310,6 @@ /** * {@inheritdoc} */ - public function showRevisionFormFields() { - return FALSE; - } - - /** - * {@inheritdoc} - */ public function isDefaultTranslation() { return $this->activeLangcode === LanguageInterface::LANGCODE_DEFAULT; } diff -u b/core/lib/Drupal/Core/Entity/ContentEntityForm.php b/core/lib/Drupal/Core/Entity/ContentEntityForm.php --- b/core/lib/Drupal/Core/Entity/ContentEntityForm.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityForm.php @@ -54,7 +54,7 @@ parent::prepareEntity(); // Hide the current revision log message in UI. - if ($this->entity instanceof RevisionLogInterface && !$this->entity->isNew()) { + if ($this->showRevisionUi() && !$this->entity->isNew()) { $this->entity->setRevisionLogMessage(NULL); } } @@ -77,11 +77,15 @@ */ public function form(array $form, FormStateInterface $form_state) { - // Advanced tab must be the first, because other fields rely on that. - $form['advanced'] = [ - '#type' => 'vertical_tabs', - '#weight' => 99, - ]; + if ($this->showRevisionUi()) { + // Advanced tab must be the first, because other fields rely on that. + if (!isset($form['advanced'])) { + $form['advanced'] = [ + '#type' => 'vertical_tabs', + '#weight' => 99, + ]; + } + } $form = parent::form($form, $form_state); @@ -95,7 +99,7 @@ // Allow modules to act before and after form language is updated. $form['#entity_builders']['update_form_langcode'] = '::updateFormLangcode'; - if ($this->entity->showRevisionFormFields()) { + if ($this->showRevisionUi()) { $this->addRevisionableFormFields($form); } @@ -121,8 +125,7 @@ // Mark the entity as requiring validation. $entity->setValidationRequired(!$form_state->getTemporaryValue('entity_validated')); - if ($entity->getEntityType()->hasKey('revision')) { - + if ($this->showRevisionUi()) { // Save as a new revision if requested to do so. if (!$form_state->isValueEmpty('revision')) { $entity->setNewRevision(); @@ -175,7 +178,8 @@ * {@inheritdoc} */ public function save(array $form, FormStateInterface $form_state) { - if ($this->entity->showRevisionFormFields()) { + parent::save($form, $form_state); + if ($this->showRevisionUi()) { $this->saveRevisionableFormFields($form, $form_state); } } @@ -464,2 +468,12 @@ + /** + * Checks whether the revision form fields should be added to the form. + * + * @return bool + * TRUE if the form field should be added, FALSE otherwise. + */ + protected function showRevisionUi() { + return $this->entity->getEntityType()->showRevisionUi(); + } + } reverted: --- b/core/lib/Drupal/Core/Entity/ContentEntityInterface.php +++ a/core/lib/Drupal/Core/Entity/ContentEntityInterface.php @@ -53,12 +53,4 @@ */ public function isRevisionTranslationAffected(); - /** - * Checks whether the revision form fields should be added to the form. - * - * @return bool - * TRUE if the form field should be added, FALSE otherwise. - */ - public function showRevisionFormFields(); - } diff -u b/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php --- b/core/modules/block_content/src/Entity/BlockContent.php +++ b/core/modules/block_content/src/Entity/BlockContent.php @@ -35,6 +35,7 @@ * base_table = "block_content", * revision_table = "block_content_revision", * data_table = "block_content_field_data", + * show_revision_ui = TRUE, * links = { * "canonical" = "/block/{block_content}", * "delete-form" = "/block/{block_content}/delete", @@ -298,13 +299,6 @@ } /** - * {@inheritdoc} - */ - public function showRevisionFormFields() { - return TRUE; - } - - /** * Invalidates the block plugin cache after changes and deletions. */ protected static function invalidateBlockPluginCache() { diff -u b/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php --- b/core/modules/node/src/Entity/Node.php +++ b/core/modules/node/src/Entity/Node.php @@ -46,6 +46,7 @@ * data_table = "node_field_data", * revision_table = "node_revision", * revision_data_table = "node_field_revision", + * show_revision_ui = TRUE, * translatable = TRUE, * list_cache_contexts = { "user.node_grants:view" }, * entity_keys = { @@ -354,13 +355,6 @@ /** * {@inheritdoc} */ - public function showRevisionFormFields() { - return TRUE; - } - - /** - * {@inheritdoc} - */ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { $fields = parent::baseFieldDefinitions($entity_type); $fields += static::publishedBaseFieldDefinitions($entity_type); only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -175,6 +175,13 @@ class EntityType implements EntityTypeInterface { protected $translatable = FALSE; /** + * Indicates whether the revision form fields should be added to the form. + * + * @var bool + */ + protected $show_revision_ui = FALSE; + + /** * The human-readable name of the type. * * @var string @@ -692,6 +699,13 @@ public function getBaseTable() { /** * {@inheritdoc} */ + public function showRevisionUi() { + return $this->show_revision_ui; + } + + /** + * {@inheritdoc} + */ public function isTranslatable() { return !empty($this->translatable); } only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -574,6 +574,14 @@ public function getBaseTable(); public function isTranslatable(); /** + * Indicates whether the revision form fields should be added to the form. + * + * @return bool + * TRUE if the form field should be added, FALSE otherwise. + */ + public function showRevisionUi(); + + /** * Indicates whether entities of this type have revision support. * * @return bool