diff --git a/core/modules/block_content/src/BlockContentForm.php b/core/modules/block_content/src/BlockContentForm.php index 2481703..f5c9692 100644 --- a/core/modules/block_content/src/BlockContentForm.php +++ b/core/modules/block_content/src/BlockContentForm.php @@ -8,7 +8,6 @@ namespace Drupal\block_content; use Drupal\Component\Utility\Html; -use Drupal\block_content\Entity\BlockContentType; use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityStorageInterface; @@ -81,11 +80,12 @@ public static function create(ContainerInterface $container) { protected function prepareEntity() { $block = $this->entity; // Set up default values, if required. + $block_type = entity_load('block_content_type', $block->bundle()); if (!$block->isNew()) { $block->setRevisionLog(NULL); } // Always use the default revision setting. - $block->set('revision', BlockContentType::load($block->getBlockContentType())->isNewRevision()); + $block->setNewRevision($block_type->isNewRevision()); } /** @@ -160,10 +160,10 @@ public function form(array $form, FormStateInterface $form_state) { */ public function save(array $form, FormStateInterface $form_state) { // Save as a new revision if requested to do so. if (!$form_state->isValueEmpty('revision')) { - $block->set('revision', FALSE); + $block->setNewRevision(); } $insert = $block->isNew(); diff --git a/core/modules/block_content/src/BlockContentInterface.php b/core/modules/block_content/src/BlockContentInterface.php index a5db5a9..b347674 100644 --- a/core/modules/block_content/src/BlockContentInterface.php +++ b/core/modules/block_content/src/BlockContentInterface.php @@ -88,12 +88,4 @@ public function getInstances(); */ public function getBlockContentType(); - /** - * Returns the block description. - * - * @return string - * The description of this block. - */ - public function getDescription(); - } diff --git a/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php index 6323b2b..f527944 100644 --- a/core/modules/block_content/src/Entity/BlockContent.php +++ b/core/modules/block_content/src/Entity/BlockContent.php @@ -144,13 +144,6 @@ public function getBlockContentType() { /** * {@inheritdoc} */ - public function getDescription() { - return $this->get('info')->value; - } - - /** - * {@inheritdoc} - */ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { $fields['id'] = BaseFieldDefinition::create('integer') ->setLabel(t('Custom block ID')) diff --git a/core/modules/block_content/src/Tests/BlockContentRevisionsTest.php b/core/modules/block_content/src/Tests/BlockContentRevisionsTest.php index fd47722..79233f3 100644 --- a/core/modules/block_content/src/Tests/BlockContentRevisionsTest.php +++ b/core/modules/block_content/src/Tests/BlockContentRevisionsTest.php @@ -45,7 +45,7 @@ protected function setUp() { // Create three revisions. $revision_count = 3; for ($i = 0; $i < $revision_count; $i++) { - $block->set('revision', TRUE); + $block->setNewRevision(TRUE); $block->setRevisionLog($this->randomMachineName(32)); $logs[] = $block->getRevisionLog(); $block->save(); @@ -78,7 +78,7 @@ public function testRevisions() { // Make a new revision and set it to not be default. // This will create a new revision that is not "front facing". // Save this as a non-default revision. - $loaded->set('revision', FALSE); + $loaded->setNewRevision(); $loaded->isDefaultRevision(FALSE); $loaded->body = $this->randomMachineName(8); $loaded->save();