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
@@ -24,7 +24,7 @@
protected function prepareEntity() {
parent::prepareEntity();
- // Set up default values, if required.
+ // Hide the current revision log message in UI.
if (!$this->entity->isNew()) {
$this->entity->setRevisionLogMessage(NULL);
}
@@ -47,23 +47,26 @@
* {@inheritdoc}
*/
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,
+ ];
+
+ $form = parent::form($form, $form_state);
+
$entity_type = $this->entity->getEntityType();
$bundle_entity = $this->getBundleEntity();
$account = $this->currentUser();
if ($this->operation == 'edit') {
- $form['#title'] = $this->t('Edit %bundle_label @label', [
- '%bundle_label' => $bundle_entity ? $bundle_entity->label() : '',
+ $form['#title'] = $this->t('Edit @bundle_label @label', [
+ '@bundle_label' => $bundle_entity ? $bundle_entity->label() : '',
'@label' => $this->entity->label(),
]);
}
- $form['advanced'] = [
- '#type' => 'vertical_tabs',
- '#attributes' => array('class' => array('entity-meta')),
- '#weight' => 99,
- ];
$new_revision_default = FALSE;
- $bundle_entity = $this->getBundleEntity();
if ($bundle_entity instanceof RevisionableEntityBundleInterface) {
// Always use the default revision setting.
$new_revision_default = $bundle_entity->shouldCreateNewRevision();
@@ -100,7 +103,11 @@
];
}
- return parent::form($form, $form_state);
+ if (isset($form['revision_log'])) {
+ $form['revision_log']['#group'] = 'revision_information';
+ }
+
+ return $form;
}
/**
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
@@ -27,7 +27,7 @@
$form = parent::form($form, $form_state);
if ($this->operation == 'edit') {
- $form['#title'] = $this->t('Edit custom block %label', array('%label' => $block->label()));
+ $form['#title'] = $this->t('Edit custom block %label', ['%label' => $block->label()]);
}
// Override the default CSS class name, since the user-defined custom block
// type name in 'TYPE-block-form' potentially clashes with third-party class
@@ -57,10 +57,10 @@
}
$form_state->setRedirect(
'block.admin_add',
- array(
+ [
'plugin_id' => 'block_content:' . $block->uuid(),
'theme' => $theme,
- )
+ ]
);
}
}
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
@@ -95,23 +95,20 @@
$form = parent::form($form, $form_state);
- if ($this->operation == 'edit') {
- $form['#title'] = $this->t('Edit @type @title', array('@type' => $node->type->entity->label(), '@title' => $node->label()));
- }
+ $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();
- $form['revision_log'] += array(
- '#group' => 'revision_information',
- '#states' => array(
- 'visible' => array(
- ':input[name="revision"]' => array('checked' => TRUE),
- ),
- ),
- );
+ $form['revision_log'] += [
+ '#states' => [
+ 'visible' => [
+ ':input[name="revision"]' => ['checked' => TRUE],
+ ],
+ ],
+ ];
// Node author information for administrators.
$form['author'] = array(