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
@@ -3,8 +3,11 @@
namespace Drupal\Core\Entity\Form;
use Drupal\Core\Entity\ContentEntityForm;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\RevisionableEntityBundleInterface;
use Drupal\Core\Form\FormStateInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Extends the base entity form with revision support in the UI.
@@ -19,6 +22,37 @@
protected $entity;
/**
+ * The entity type bundle info service.
+ *
+ * @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface
+ */
+ protected $entityTypeBundleInfo;
+
+ /**
+ * Constructs a ContentEntityForm object.
+ *
+ * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
+ * The entity manager.
+ * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
+ * The entity type bundle info service.
+ */
+ public function __construct(EntityManagerInterface $entity_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info) {
+ parent::__construct($entity_manager);
+
+ $this->entityTypeBundleInfo = $entity_type_bundle_info;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function create(ContainerInterface $container) {
+ return new static(
+ $container->get('entity.manager'),
+ $container->get('entity_type.bundle.info')
+ );
+ }
+
+ /**
* {@inheritdoc}
*/
protected function prepareEntity() {
@@ -57,16 +91,27 @@
$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() : '',
- '@label' => $this->entity->label(),
- ]);
+
+ $bundleInfo = $this->entityTypeBundleInfo->getBundleInfo($entity_type->id());
+ if ($bundleInfo[$this->entity->bundle()]) {
+ $bundleLabel = $bundleInfo[$this->entity->bundle()]['label'];
+ $form['#title'] = $this->t('Edit @bundle_label @label', [
+ '@bundle_label' => $bundleLabel,
+ '@label' => $this->entity->label(),
+ ]);
+ }
+ else {
+ $form['#title'] = $this->t('Edit @label', [
+ '@label' => $this->entity->label(),
+ ]);
+ }
}
$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();
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,8 +34,6 @@
// names.
$form['#attributes']['class'][0] = 'block-' . Html::getClass($block->bundle()) . '-form';
- // Add a log field if the "Create new revision" option is checked, or if the
- // current user has the ability to check that option.
$form['revision_information']['#attributes']['class'][] = 'block-content-form-revision-information';
$form['revision_information']['#attached']['library'][] = 'block_content/drupal.block_content';
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
@@ -3,6 +3,7 @@
namespace Drupal\node;
use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\Form\RevisionableContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
use Drupal\user\PrivateTempStoreFactory;
@@ -33,8 +34,8 @@
* @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
* The factory for the temp store object.
*/
- public function __construct(EntityManagerInterface $entity_manager, PrivateTempStoreFactory $temp_store_factory) {
- parent::__construct($entity_manager);
+ public function __construct(EntityManagerInterface $entity_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info, PrivateTempStoreFactory $temp_store_factory) {
+ parent::__construct($entity_manager, $entity_type_bundle_info);
$this->tempStoreFactory = $temp_store_factory;
}
@@ -44,6 +45,7 @@
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager'),
+ $container->get('entity_type.bundle.info'),
$container->get('user.private_tempstore')
);
}