diff -u b/core/lib/Drupal/Core/Entity/Form/RevisionableContentEntityForm.php b/core/lib/Drupal/Core/Entity/Form/RevisionableContentEntityForm.php --- b/core/lib/Drupal/Core/Entity/Form/RevisionableContentEntityForm.php +++ b/core/lib/Drupal/Core/Entity/Form/RevisionableContentEntityForm.php @@ -128,7 +128,14 @@ '#weight' => 20, '#access' => $new_revision_default || ($entity_type->get('admin_permission')) && $account->hasPermission($entity_type->get('admin_permission')), '#optional' => TRUE, + '#attributes' => [ + 'class' => ['entity-content-form-revision-information'], + ], + '#attached' => [ + 'library' => ['core/drupal.entity'], + ], ]; + $form['revision'] = [ '#type' => 'checkbox', '#title' => $this->t('Create new revision'), @@ -143,7 +150,7 @@ if (!$this->entity->isNewRevision()) { $form['revision']['#states'] = [ 'checked' => [ - 'textarea[name="revision_log"]' => ['empty' => FALSE], + 'textarea[name="revision_log[0][value]"]' => ['empty' => FALSE], ], ]; } diff -u b/core/modules/block_content/src/BlockContentForm.php b/core/modules/block_content/src/BlockContentForm.php --- b/core/modules/block_content/src/BlockContentForm.php +++ b/core/modules/block_content/src/BlockContentForm.php @@ -34,9 +34,6 @@ // names. $form['#attributes']['class'][0] = 'block-' . Html::getClass($block->bundle()) . '-form'; - $form['revision_information']['#attributes']['class'][] = 'block-content-form-revision-information'; - $form['revision_information']['#attached']['library'][] = 'block_content/drupal.block_content'; - return $form; } diff -u b/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php --- b/core/modules/node/src/NodeForm.php +++ b/core/modules/node/src/NodeForm.php @@ -99,11 +99,11 @@ $form['advanced']['#attributes']['class'][] = 'entity-meta'; - $form['revision_information']['#attributes']['class'][] = 'node-form-revision-information'; - $form['revision_information']['#attached']['library'][] = 'node/drupal.node'; - $form['revision']['#access'] = $current_user->hasPermission('administer nodes') && !$node->isNew(); + // Clear revision states, because it will conflicts with revision_log state. + $form['revision']['#states']['checked'] = []; + $form['revision_log'] += [ '#states' => [ 'visible' => [ only in patch2: unchanged: --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -203,6 +203,15 @@ drupal.dropbutton: - core/drupalSettings - core/jquery.once +drupal.entity: + version: VERSION + js: + misc/entity.js: {} + dependencies: + - core/jquery + - core/drupal + - core/drupal.form + drupal.form: version: VERSION js: only in patch2: unchanged: --- a/core/modules/block_content/js/block_content.js +++ b/core/misc/entity.js @@ -8,20 +8,20 @@ 'use strict'; /** - * Sets summaries about revision and translation of block content. + * Sets summaries about revision and translation of entities. * * @type {Drupal~behavior} * * @prop {Drupal~behaviorAttach} attach - * Attaches summary behaviour block content form tabs. + * Attaches summary behaviour entity form tabs. * * Specifically, it updates summaries to the revision information and the * translation options. */ - Drupal.behaviors.blockContentDetailsSummaries = { + Drupal.behaviors.entityContentDetailsSummaries = { attach: function (context) { var $context = $(context); - $context.find('.block-content-form-revision-information').drupalSetSummary(function (context) { + $context.find('.entity-content-form-revision-information').drupalSetSummary(function (context) { var $revisionContext = $(context); var revisionCheckbox = $revisionContext.find('.js-form-item-revision input'); @@ -36,7 +36,7 @@ return Drupal.t('No revision'); }); - $context.find('fieldset.block-content-translation-options').drupalSetSummary(function (context) { + $context.find('details.entity-translation-options').drupalSetSummary(function (context) { var $translationContext = $(context); var translate; var $checkbox = $translationContext.find('.js-form-item-translation-translate input'); only in patch2: unchanged: --- a/core/modules/block_content/block_content.libraries.yml +++ /dev/null @@ -1,8 +0,0 @@ -drupal.block_content: - version: VERSION - js: - js/block_content.js: {} - dependencies: - - core/jquery - - core/drupal - - core/drupal.form only in patch2: unchanged: --- a/core/modules/block_content/src/BlockContentTranslationHandler.php +++ b/core/modules/block_content/src/BlockContentTranslationHandler.php @@ -15,23 +15,6 @@ class BlockContentTranslationHandler extends ContentTranslationHandler { /** * {@inheritdoc} */ - public function entityFormAlter(array &$form, FormStateInterface $form_state, EntityInterface $entity) { - parent::entityFormAlter($form, $form_state, $entity); - // Move the translation fieldset to a vertical tab. - if (isset($form['translation'])) { - $form['translation'] += array( - '#group' => 'additional_settings', - '#weight' => 100, - '#attributes' => array( - 'class' => array('block-content-translation-options'), - ), - ); - } - } - - /** - * {@inheritdoc} - */ protected function entityFormTitle(EntityInterface $entity) { $block_type = BlockContentType::load($entity->bundle()); return t('Edit @type @title', array('@type' => $block_type->label(), '@title' => $entity->label())); only in patch2: unchanged: --- a/core/modules/block_content/src/BlockContentTypeInterface.php +++ b/core/modules/block_content/src/BlockContentTypeInterface.php @@ -3,11 +3,12 @@ namespace Drupal\block_content; use Drupal\Core\Config\Entity\ConfigEntityInterface; +use Drupal\Core\Entity\RevisionableEntityBundleInterface; /** * Provides an interface defining a custom block type entity. */ -interface BlockContentTypeInterface extends ConfigEntityInterface { +interface BlockContentTypeInterface extends ConfigEntityInterface, RevisionableEntityBundleInterface { /** * Returns the description of the block type. @@ -17,12 +18,4 @@ */ public function getDescription(); - /** - * Returns whether a new revision should be created by default. - * - * @return bool - * TRUE if a new revision should be created by default. - */ - public function shouldCreateNewRevision(); - } only in patch2: unchanged: --- a/core/modules/content_translation/src/ContentTranslationHandler.php +++ b/core/modules/content_translation/src/ContentTranslationHandler.php @@ -384,6 +384,16 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En '#multilingual' => TRUE, ); + if (isset($form['advanced'])) { + $form['content_translation'] += array( + '#group' => 'advanced', + '#weight' => 100, + '#attributes' => array( + 'class' => array('entity-translation-options'), + ), + ); + } + // A new translation is enabled by default. $metadata = $this->manager->getTranslationMetadata($entity); $status = $new_translation || $metadata->isPublished(); only in patch2: unchanged: --- a/core/modules/node/node.js +++ b/core/modules/node/node.js @@ -18,21 +18,6 @@ Drupal.behaviors.nodeDetailsSummaries = { attach: function (context) { var $context = $(context); - $context.find('.node-form-revision-information').drupalSetSummary(function (context) { - var $revisionContext = $(context); - var revisionCheckbox = $revisionContext.find('.js-form-item-revision input'); - - // Return 'New revision' if the 'Create new revision' checkbox is - // checked, or if the checkbox doesn't exist, but the revision log does. - // For users without the "Administer content" permission the checkbox - // won't appear, but the revision log will if the content type is set to - // auto-revision. - if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $revisionContext.find('.js-form-item-revision-log textarea').length)) { - return Drupal.t('New revision'); - } - - return Drupal.t('No revision'); - }); $context.find('.node-form-author').drupalSetSummary(function (context) { var $authorContext = $(context); @@ -64,22 +49,6 @@ return Drupal.t('Not promoted'); } }); - - $context.find('fieldset.node-translation-options').drupalSetSummary(function (context) { - var $translationContext = $(context); - var translate; - var $checkbox = $translationContext.find('.js-form-item-translation-translate input'); - - if ($checkbox.size()) { - translate = $checkbox.is(':checked') ? Drupal.t('Needs to be updated') : Drupal.t('Does not need to be updated'); - } - else { - $checkbox = $translationContext.find('.js-form-item-translation-retranslate input'); - translate = $checkbox.is(':checked') ? Drupal.t('Flag other translations as outdated') : Drupal.t('Do not flag other translations as outdated'); - } - - return translate; - }); } }; only in patch2: unchanged: --- a/core/modules/node/node.libraries.yml +++ b/core/modules/node/node.libraries.yml @@ -6,10 +6,8 @@ drupal.node: js: node.js: {} dependencies: - - core/jquery - - core/drupal + - core/drupal.entity - core/drupalSettings - - core/drupal.form drupal.node.preview: version: VERSION only in patch2: unchanged: --- a/core/modules/node/src/NodeTranslationHandler.php +++ b/core/modules/node/src/NodeTranslationHandler.php @@ -17,17 +17,7 @@ class NodeTranslationHandler extends ContentTranslationHandler { public function entityFormAlter(array &$form, FormStateInterface $form_state, EntityInterface $entity) { parent::entityFormAlter($form, $form_state, $entity); - // Move the translation fieldset to a vertical tab. if (isset($form['content_translation'])) { - $form['content_translation'] += array( - '#group' => 'advanced', - '#attributes' => array( - 'class' => array('node-translation-options'), - ), - ); - - $form['content_translation']['#weight'] = 100; - // We do not need to show these values on node forms: they inherit the // basic node property values. $form['content_translation']['status']['#access'] = FALSE;