diff --git a/core/modules/block_content/src/BlockContentListBuilder.php b/core/modules/block_content/src/BlockContentListBuilder.php index 731f2da..7d1908f 100644 --- a/core/modules/block_content/src/BlockContentListBuilder.php +++ b/core/modules/block_content/src/BlockContentListBuilder.php @@ -7,6 +7,8 @@ namespace Drupal\block_content; +use Drupal\block_content\Entity\BlockContentType; +use Drupal\Component\Utility\String; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityListBuilder; @@ -22,6 +24,7 @@ class BlockContentListBuilder extends EntityListBuilder { */ public function buildHeader() { $header['label'] = t('Block description'); + $header['type'] = $this->t('Block Type'); return $header + parent::buildHeader(); } @@ -30,6 +33,8 @@ public function buildHeader() { */ public function buildRow(EntityInterface $entity) { $row['label'] = $this->getLabel($entity); + $type = BlockContentType::load($entity->bundle()); + $row['type'] = String::checkPlain($type->label()); return $row + parent::buildRow($entity); } diff --git a/core/modules/block_content/src/Tests/BlockContentListTest.php b/core/modules/block_content/src/Tests/BlockContentListTest.php index c644286..a776a3f 100644 --- a/core/modules/block_content/src/Tests/BlockContentListTest.php +++ b/core/modules/block_content/src/Tests/BlockContentListTest.php @@ -40,10 +40,10 @@ public function testListing() { // Test the table header. $elements = $this->xpath('//div[@class="layout-content"]//table/thead/tr/th'); - $this->assertEqual(count($elements), 2, 'Correct number of table header cells found.'); + $this->assertEqual(count($elements), 3, 'Correct number of table header cells found.'); // Test the contents of each th cell. - $expected_items = array(t('Block description'), t('Operations')); + $expected_items = array(t('Block description'), t('Block Type'), t('Operations')); foreach ($elements as $key => $element) { $this->assertIdentical((string) $element[0], $expected_items[$key]); } @@ -66,7 +66,7 @@ public function testListing() { // Check the number of table row cells. $elements = $this->xpath('//div[@class="layout-content"]//table/tbody/tr[@class="odd"]/td'); - $this->assertEqual(count($elements), 2, 'Correct number of table row cells found.'); + $this->assertEqual(count($elements), 3, 'Correct number of table row cells found.'); // Check the contents of each row cell. The first cell contains the label, // the second contains the machine name, and the third contains the // operations list. diff --git a/core/modules/block_content/src/Tests/BlockContentTypeTest.php b/core/modules/block_content/src/Tests/BlockContentTypeTest.php index 60f1210..632ba72 100644 --- a/core/modules/block_content/src/Tests/BlockContentTypeTest.php +++ b/core/modules/block_content/src/Tests/BlockContentTypeTest.php @@ -113,6 +113,9 @@ public function testBlockContentTypeDeletion() { // Add a new block of this type. $block = $this->createBlockContent(FALSE, 'foo'); + // Assert that the block-type is shown in the listing. + $this->drupalGet('admin/structure/block/block-content'); + $this->assertText('foo'); // Attempt to delete the block type, which should not be allowed. $this->drupalGet('admin/structure/block/block-content/manage/' . $type->id() . '/delete'); $this->assertRaw(