diff --git a/core/modules/block_content/block_content.links.menu.yml b/core/modules/block_content/block_content.links.menu.yml new file mode 100644 index 0000000..03209f9 --- /dev/null +++ b/core/modules/block_content/block_content.links.menu.yml @@ -0,0 +1,5 @@ +entity.block_content_type.collection: + title: Block types + route_name: entity.block_content_type.collection + parent: system.admin_structure + description: 'List and edit custom block types.' diff --git a/core/modules/block_content/block_content.links.task.yml b/core/modules/block_content/block_content.links.task.yml index 2b88171..7f9ce4d 100644 --- a/core/modules/block_content/block_content.links.task.yml +++ b/core/modules/block_content/block_content.links.task.yml @@ -1,16 +1,7 @@ entity.block_content.collection: - title: 'Custom block library' + title: 'Custom blocks' route_name: entity.block_content.collection - base_route: block.admin_display -block_content.list_sub: - title: Blocks - route_name: entity.block_content.collection - parent_id: entity.block_content.collection -entity.block_content_type.collection: - title: Types - route_name: entity.block_content_type.collection - parent_id: entity.block_content.collection - weight: 1 + base_route: system.admin_content entity.block_content.canonical: title: Edit diff --git a/core/modules/block_content/block_content.module b/core/modules/block_content/block_content.module index 04a1e6c..5a8c222 100644 --- a/core/modules/block_content/block_content.module +++ b/core/modules/block_content/block_content.module @@ -18,22 +18,22 @@ function block_content_help($route_name, RouteMatchInterface $route_match) { $field_ui = \Drupal::moduleHandler()->moduleExists('field_ui') ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#'; $output = ''; $output .= '

' . t('About') . '

'; - $output .= '

' . t('The Custom Block module allows you to create custom block types and content-containing blocks, and provides a Custom block library listing all of them. Custom block types have fields; see the Field module help for more information. Once created, custom blocks can be placed in regions just like blocks provided by other modules; see the Block module help page for details. For more information, see the online documentation for the Custom Block module.', array('!block-library' => \Drupal::url('entity.block_content.collection'), '!block-content' => \Drupal::url('entity.block_content.collection'), '!field-help' => \Drupal::url('help.page', array('name' => 'field')), '!blocks' => \Drupal::url('help.page', array('name' => 'block')), '!online-help' => 'https://www.drupal.org/documentation/modules/block_content')) . '

'; + $output .= '

' . t('The Custom Block module allows you to create custom block types and content-containing blocks, and provides a page listing all of them. Custom block types have fields; see the Field module help for more information. Once created, custom blocks can be placed in regions just like blocks provided by other modules; see the Block module help page for details. For more information, see the online documentation for the Custom Block module.', array('!block-list' => \Drupal::url('entity.block_content.collection'), '!block-content' => \Drupal::url('entity.block_content.collection'), '!field-help' => \Drupal::url('help.page', array('name' => 'field')), '!blocks' => \Drupal::url('help.page', array('name' => 'block')), '!online-help' => 'https://www.drupal.org/documentation/modules/block_content')) . '

'; $output .= '

' . t('Uses') . '

'; $output .= '
'; $output .= '
' . t('Creating and managing custom block types') . '
'; - $output .= '
' . t('Users with the Administer blocks permission can create and edit custom block types with fields and display settings, from the Custom block types page in the Custom block library. For more information about managing fields and display settings, see the Field UI module help.', array('!types' => \Drupal::url('entity.block_content_type.collection'), '!field-ui' => $field_ui)) . '
'; + $output .= '
' . t('Users with the Administer blocks permission can create and edit custom block types with fields and display settings, from the Block types page. For more information about managing fields and display settings, see the Field UI module help.', array('!types' => \Drupal::url('entity.block_content_type.collection'), '!field-ui' => $field_ui)) . '
'; $output .= '
' . t('Creating custom blocks') . '
'; - $output .= '
' . t('Users with the Administer blocks permission can create, edit, and delete custom blocks of each custom block type you have defined, from the Custom block library page. Custom blocks are shown in the Place blocks list on the Block layout page; see the Block module help for more information about placing blocks.', array('!blocks' => \Drupal::url('block.admin_display'), '!block-library' => \Drupal::url('entity.block_content.collection'), '!block_help' => \Drupal::url('help.page', array('name' => 'block')))) . '
'; + $output .= '
' . t('Users with the Administer blocks permission can create, edit, and delete custom blocks of each custom block type you have defined, from the Custom blocks page. Custom blocks are shown in the Place blocks list on the Block layout page; see the Block module help for more information about placing blocks.', array('!blocks' => \Drupal::url('block.admin_display'), '!block-list' => \Drupal::url('entity.block_content.collection'), '!block_help' => \Drupal::url('help.page', array('name' => 'block')))) . '
'; $output .= '
'; return $output; case 'entity.block_content.collection': - $output = '

' . t('Blocks in the block library belong to block types, each with its own fields and display settings. After creating a block, place it in a region from the Block layout page.', array('!types' => \Drupal::url('entity.block_content_type.collection'), '!blocks' => \Drupal::url('block.admin_display'))) . '

'; + $output = '

' . t('Blocks belong to block types, each with its own fields and display settings. After creating a block, place it in a region from the Block layout page.', array('!types' => \Drupal::url('entity.block_content_type.collection'), '!blocks' => \Drupal::url('block.admin_display'))) . '

'; return $output; case 'entity.block_content_type.collection': - $output = '

' . t('Each block type has its own fields and display settings. Create blocks of each type on the Block library page.', array('!block-library' => \Drupal::url('entity.block_content.collection'))) . '

'; + $output = '

' . t('Each block type has its own fields and display settings. Create blocks of each type on the Custom blocks page.', array('!block-list' => \Drupal::url('entity.block_content.collection'))) . '

'; return $output; } diff --git a/core/modules/block_content/block_content.routing.yml b/core/modules/block_content/block_content.routing.yml index 3542ca8..957349d 100644 --- a/core/modules/block_content/block_content.routing.yml +++ b/core/modules/block_content/block_content.routing.yml @@ -1,8 +1,8 @@ entity.block_content_type.collection: - path: '/admin/structure/block/block-content/types' + path: '/admin/structure/block-content' defaults: _entity_list: 'block_content_type' - _title: 'Custom block library' + _title: 'Block types' requirements: _permission: 'administer blocks' @@ -27,7 +27,7 @@ block_content.add_form: _permission: 'administer blocks' entity.block_content_type.delete_form: - path: '/admin/structure/block/block-content/manage/{block_content_type}/delete' + path: '/admin/structure/block-content/manage/{block_content_type}/delete' defaults: _entity_form: 'block_content_type.delete' _title: 'Delete' @@ -65,7 +65,7 @@ entity.block_content.delete_form: _entity_access: 'block_content.delete' block_content.type_add: - path: '/admin/structure/block/block-content/types/add' + path: '/admin/structure/block-content/add' defaults: _entity_form: 'block_content_type.add' _title: 'Add' @@ -73,7 +73,7 @@ block_content.type_add: _permission: 'administer blocks' entity.block_content_type.edit_form: - path: '/admin/structure/block/block-content/manage/{block_content_type}' + path: '/admin/structure/block-content/manage/{block_content_type}' defaults: _entity_form: 'block_content_type.edit' _title: 'Edit' @@ -81,9 +81,9 @@ entity.block_content_type.edit_form: _entity_access: 'block_content_type.update' entity.block_content.collection: - path: '/admin/structure/block/block-content' + path: '/admin/content/block-content' defaults: - _title: 'Custom block library' + _title: 'Custom blocks' _entity_list: 'block_content' requirements: _permission: 'administer blocks' diff --git a/core/modules/block_content/config/optional/views.view.block_content.yml b/core/modules/block_content/config/optional/views.view.block_content.yml index ad5e1f9..9ab5b83 100644 --- a/core/modules/block_content/config/optional/views.view.block_content.yml +++ b/core/modules/block_content/config/optional/views.view.block_content.yml @@ -5,7 +5,7 @@ dependencies: - block_content - user id: block_content -label: 'Custom block library' +label: 'Custom blocks' module: views description: 'Find and manage custom blocks.' tag: '' @@ -430,7 +430,7 @@ display: entity_field: type plugin_id: bundle sorts: { } - title: 'Custom block library' + title: 'Custom blocks' header: { } footer: { } empty: @@ -472,12 +472,12 @@ display: position: 1 display_options: display_extenders: { } - path: admin/structure/block/block-content + path: admin/content/block-content menu: type: tab - title: 'Custom block library' + title: 'Custom blocks' description: '' - parent: block.admin_display + parent: system.admin_content weight: 0 context: '0' menu_name: admin diff --git a/core/modules/block_content/src/BlockContentViewsData.php b/core/modules/block_content/src/BlockContentViewsData.php index abb2cb2..60105e0 100644 --- a/core/modules/block_content/src/BlockContentViewsData.php +++ b/core/modules/block_content/src/BlockContentViewsData.php @@ -29,7 +29,7 @@ public function getViewsData() { $data['block_content_field_data']['type']['field']['id'] = 'field'; $data['block_content']['block_content_listing_empty'] = array( - 'title' => t('Empty block library behavior'), + 'title' => t('Empty custom blocks page behavior'), 'help' => t('Provides a link to add a new block.'), 'area' => array( 'id' => 'block_content_listing_empty', diff --git a/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php index 4e186b9..2e7179f 100644 --- a/core/modules/block_content/src/Entity/BlockContent.php +++ b/core/modules/block_content/src/Entity/BlockContent.php @@ -43,7 +43,7 @@ * "canonical" = "/block/{block_content}", * "delete-form" = "/block/{block_content}/delete", * "edit-form" = "/block/{block_content}", - * "collection" = "/admin/structure/block/block-content", + * "collection" = "/admin/structure/block-content", * }, * translatable = TRUE, * entity_keys = { diff --git a/core/modules/block_content/src/Entity/BlockContentType.php b/core/modules/block_content/src/Entity/BlockContentType.php index 8494814..f04511f 100644 --- a/core/modules/block_content/src/Entity/BlockContentType.php +++ b/core/modules/block_content/src/Entity/BlockContentType.php @@ -35,9 +35,9 @@ * "label" = "label" * }, * links = { - * "delete-form" = "/admin/structure/block/block-content/manage/{block_content_type}/delete", - * "edit-form" = "/admin/structure/block/block-content/manage/{block_content_type}", - * "collection" = "/admin/structure/block/block-content/types", + * "delete-form" = "/admin/structure/block-content/manage/{block_content_type}/delete", + * "edit-form" = "/admin/structure/block-content/manage/{block_content_type}", + * "collection" = "/admin/structure/block-content/types", * }, * config_export = { * "id", diff --git a/core/modules/block_content/src/Tests/BlockContentListTest.php b/core/modules/block_content/src/Tests/BlockContentListTest.php index aeed4dc..f3d575b 100644 --- a/core/modules/block_content/src/Tests/BlockContentListTest.php +++ b/core/modules/block_content/src/Tests/BlockContentListTest.php @@ -30,10 +30,10 @@ class BlockContentListTest extends BlockContentTestBase { */ public function testListing() { $this->drupalLogin($this->drupalCreateUser(array('administer blocks', 'translate configuration'))); - $this->drupalGet('admin/structure/block/block-content'); + $this->drupalGet('admin/content/block-content'); // Test for the page title. - $this->assertTitle(t('Custom block library') . ' | Drupal'); + $this->assertTitle(t('Custom blocks') . ' | Drupal'); // Test for the table. $element = $this->xpath('//div[@class="layout-content"]//table'); diff --git a/core/modules/block_content/src/Tests/BlockContentListViewsTest.php b/core/modules/block_content/src/Tests/BlockContentListViewsTest.php index ba84f2b..f1b5941 100644 --- a/core/modules/block_content/src/Tests/BlockContentListViewsTest.php +++ b/core/modules/block_content/src/Tests/BlockContentListViewsTest.php @@ -28,10 +28,10 @@ class BlockContentListViewsTest extends BlockContentTestBase { */ public function testListing() { $this->drupalLogin($this->drupalCreateUser(array('administer blocks', 'translate configuration'))); - $this->drupalGet('admin/structure/block/block-content'); + $this->drupalGet('admin/content/block-content'); // Test for the page title. - $this->assertTitle(t('Custom block library') . ' | Drupal'); + $this->assertTitle(t('Custom blocks') . ' | Drupal'); // Test for the table. $element = $this->xpath('//div[@class="layout-content"]//table'); diff --git a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php index d17fc3b..3f1eba3 100644 --- a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php +++ b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php @@ -137,7 +137,7 @@ protected function doTestBasicTranslation() { } // Check that the translate operation link is shown. - $this->drupalGet('admin/structure/block/block-content'); + $this->drupalGet('admin/content/block-content'); $this->assertLinkByHref('block/' . $entity->id() . '/translations'); } diff --git a/core/modules/block_content/src/Tests/BlockContentTypeTest.php b/core/modules/block_content/src/Tests/BlockContentTypeTest.php index 20dc1a2..08c92e7 100644 --- a/core/modules/block_content/src/Tests/BlockContentTypeTest.php +++ b/core/modules/block_content/src/Tests/BlockContentTypeTest.php @@ -71,7 +71,7 @@ public function testBlockContentTypeCreation() { 'id' => 'foo', 'label' => 'title for foo', ); - $this->drupalPostForm('admin/structure/block/block-content/types/add', $edit, t('Save')); + $this->drupalPostForm('admin/structure/block-content/add', $edit, t('Save')); $block_type = BlockContentType::load('foo'); $this->assertTrue($block_type, 'The new block type has been created.'); @@ -106,7 +106,7 @@ public function testBlockContentTypeEditing() { $edit = array( 'label' => 'Bar', ); - $this->drupalPostForm('admin/structure/block/block-content/manage/basic', $edit, t('Save')); + $this->drupalPostForm('admin/structure/block-content/manage/basic', $edit, t('Save')); \Drupal::entityManager()->clearCachedFieldDefinitions(); $this->drupalGet('block/add'); @@ -115,9 +115,9 @@ public function testBlockContentTypeEditing() { $this->assertUrl(\Drupal::url('block_content.add_form', ['block_content_type' => 'basic'], ['absolute' => TRUE]), [], 'Original machine name was used in URL.'); // Remove the body field. - $this->drupalPostForm('admin/structure/block/block-content/manage/basic/fields/block_content.basic.body/delete', array(), t('Delete')); + $this->drupalPostForm('admin/structure/block-content/manage/basic/fields/block_content.basic.body/delete', array(), t('Delete')); // Resave the settings for this type. - $this->drupalPostForm('admin/structure/block/block-content/manage/basic', array(), t('Save')); + $this->drupalPostForm('admin/structure/block-content/manage/basic', array(), t('Save')); // Check that the body field doesn't exist. $this->drupalGet('block/add/basic'); $this->assertNoRaw('Body', 'Body field was not found.'); @@ -138,7 +138,7 @@ public function testBlockContentTypeDeletion() { // Add a new block of this type. $block = $this->createBlockContent(FALSE, 'foo'); // Attempt to delete the block type, which should not be allowed. - $this->drupalGet('admin/structure/block/block-content/manage/' . $type->id() . '/delete'); + $this->drupalGet('admin/structure/block-content/manage/' . $type->id() . '/delete'); $this->assertRaw( t('%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', array('%label' => $type->label())), 'The block type will not be deleted until all blocks of that type are removed.' @@ -148,7 +148,7 @@ public function testBlockContentTypeDeletion() { // Delete the block. $block->delete(); // Attempt to delete the block type, which should now be allowed. - $this->drupalGet('admin/structure/block/block-content/manage/' . $type->id() . '/delete'); + $this->drupalGet('admin/structure/block-content/manage/' . $type->id() . '/delete'); $this->assertRaw( t('Are you sure you want to delete the custom block type %type?', array('%type' => $type->id())), 'The block type is available for deletion.' @@ -218,7 +218,7 @@ public function testsBlockContentAddTypes() { // Test that adding a block from the 'custom blocks list' doesn't send you // to the block configure form. - $this->drupalGet('admin/structure/block/block-content'); + $this->drupalGet('admin/content/block-content'); $this->clickLink(t('Add custom block')); $this->clickLink('foo'); $edit = array('info[0][value]' => $this->randomMachineName(8)); diff --git a/core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php b/core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php deleted file mode 100644 index 9c01796..0000000 --- a/core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php +++ /dev/null @@ -1,85 +0,0 @@ -directoryList = array( - 'block' => 'core/modules/block', - 'block_content' => 'core/modules/block_content', - ); - parent::setUp(); - - $config_factory = $this->getConfigFactoryStub(array('system.theme' => array( - 'default' => 'test_c', - ))); - - $themes = array(); - $themes['test_a'] = (object) array( - 'status' => 0, - ); - $themes['test_b'] = (object) array( - 'status' => 1, - 'info' => array( - 'name' => 'test_b', - ), - ); - $themes['test_c'] = (object) array( - 'status' => 1, - 'info' => array( - 'name' => 'test_c', - ), - ); - $theme_handler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface'); - $theme_handler->expects($this->any()) - ->method('listInfo') - ->will($this->returnValue($themes)); - - $container = new ContainerBuilder(); - $container->set('config.factory', $config_factory); - $container->set('theme_handler', $theme_handler); - \Drupal::setContainer($container); - } - - /** - * Checks block_content listing local tasks. - * - * @dataProvider getBlockContentListingRoutes - */ - public function testBlockContentListLocalTasks($route) { - $this->assertLocalTasks($route, array( - 0 => array( - 'block.admin_display', - 'entity.block_content.collection', - ), - 1 => array( - 'block_content.list_sub', - 'entity.block_content_type.collection', - ), - )); - } - - /** - * Provides a list of routes to test. - */ - public function getBlockContentListingRoutes() { - return array( - array('entity.block_content.collection', 'entity.block_content_type.collection'), - ); - } - -} diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php index 4ceec20..d018673 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php @@ -192,9 +192,9 @@ public function doCustomContentTypeListTest() { $block_content_type->save(); // Get the custom block type listing. - $this->drupalGet('admin/structure/block/block-content/types'); + $this->drupalGet('admin/structure/block-content'); - $translate_link = 'admin/structure/block/block-content/manage/' . $block_content_type->id() . '/translate'; + $translate_link = 'admin/structure/block-content/manage/' . $block_content_type->id() . '/translate'; // Test if the link to translate the custom block type is on the page. $this->assertLinkByHref($translate_link); @@ -413,7 +413,7 @@ public function doFieldListTest() { 'field' => 'node.' . $content_type->id() . '.body', ), array( - 'list' => 'admin/structure/block/block-content/manage/basic/fields', + 'list' => 'admin/structure/block-content/manage/basic/fields', 'field' => 'block_content.basic.body', ), );