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 0000000000000000000000000000000000000000..7458516b0d16db15b69c52cc8e05047478c7a6eb --- /dev/null +++ b/core/modules/block_content/block_content.links.menu.yml @@ -0,0 +1,5 @@ +entity.block_content_type.collection: + title: 'Custom block types' + parent: system.admin_structure + description: 'Create and manage fields, forms, and display settings for your custom blocks.' + route_name: entity.block_content_type.collection diff --git a/core/modules/block_content/block_content.links.task.yml b/core/modules/block_content/block_content.links.task.yml index 0b4256b63a785c8a73e05bef462bba1e3e5132b6..27faac9f47452b54f99b12047817b8cfe0ad011b 100644 --- a/core/modules/block_content/block_content.links.task.yml +++ b/core/modules/block_content/block_content.links.task.yml @@ -2,15 +2,6 @@ entity.block_content.collection: title: 'Custom block library' 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: Block types - route_name: entity.block_content_type.collection - parent_id: entity.block_content.collection - weight: 1 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 72a51f30d850bbd39fb08c9c0c373823508a0274..9649d7da648c0e4d0adab62c9ff0b8a7e95d6f20 100644 --- a/core/modules/block_content/block_content.module +++ b/core/modules/block_content/block_content.module @@ -22,13 +22,13 @@ function block_content_help($route_name, RouteMatchInterface $route_match) { $field_ui = \Drupal::moduleHandler()->moduleExists('field_ui') ? Url::fromRoute('help.page', ['name' => 'field_ui'])->toString() : '#'; $output = ''; $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('The Custom Block module allows you to create and manage custom <em>block types</em> and <em>content-containing blocks</em> from the <a href=":block-library">Custom block library</a> page. Custom block types have fields; see the <a href=":field-help">Field module help</a> for more information. Once created, custom blocks can be placed in regions just like blocks provided by other modules; see the <a href=":blocks">Block module help</a> page for details. For more information, see the <a href=":online-help">online documentation for the Custom Block module</a>.', [':block-library' => Url::fromRoute('entity.block_content.collection')->toString(), ':block-content' => Url::fromRoute('entity.block_content.collection')->toString(), ':field-help' => Url::fromRoute('help.page', ['name' => 'field'])->toString(), ':blocks' => Url::fromRoute('help.page', ['name' => 'block'])->toString(), ':online-help' => 'https://www.drupal.org/documentation/modules/block_content']) . '</p>'; + $output .= '<p>' . t('The Custom Block module allows you to create and manage custom <em>block types</em> from the <a href=":types">Custom Block types</a> page and <em>content-containing blocks</em> from the <a href=":block-library">Custom block library</a> page. Custom block types have fields; see the <a href=":field-help">Field module help</a> for more information. Once created, custom blocks can be placed in regions just like blocks provided by other modules; see the <a href=":blocks">Block module help</a> page for details. For more information, see the <a href=":online-help">online documentation for the Custom Block module</a>.', [':types' => Url::fromRoute('entity.block_content_type.collection')->toString(), ':block-library' => Url::fromRoute('entity.block_content.collection')->toString(), ':field-help' => Url::fromRoute('help.page', ['name' => 'field'])->toString(), ':blocks' => Url::fromRoute('help.page', ['name' => 'block'])->toString(), ':online-help' => 'https://www.drupal.org/documentation/modules/block_content']) . '</p>'; $output .= '<h3>' . t('Uses') . '</h3>'; $output .= '<dl>'; $output .= '<dt>' . t('Creating and managing custom block types') . '</dt>'; - $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create and edit custom block types with fields and display settings, from the <a href=":types">Block types</a> page in the Custom block library. For more information about managing fields and display settings, see the <a href=":field-ui">Field UI module help</a>.', [':types' => Url::fromRoute('entity.block_content_type.collection')->toString(), ':field-ui' => $field_ui]) . '</dd>'; + $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create and edit custom block types with fields and display settings, from the <a href=":types">Custom Block types</a> page under the Structure menu. For more information about managing fields and display settings, see the <a href=":field-ui">Field UI module help</a>.', [':types' => Url::fromRoute('entity.block_content_type.collection')->toString(), ':field-ui' => $field_ui]) . '</dd>'; $output .= '<dt>' . t('Creating custom blocks') . '</dt>'; - $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create, edit, and delete custom blocks of each defined custom block type, from the <a href=":block-library">Blocks</a> page in the Custom block library. After creating a block, place it in a region from the <a href=":blocks">Block layout</a> page; see the <a href=":block_help">Block module help</a> for more information about placing blocks.', [':blocks' => Url::fromRoute('block.admin_display')->toString(), ':block-library' => Url::fromRoute('entity.block_content.collection')->toString(), ':block_help' => Url::fromRoute('help.page', ['name' => 'block'])->toString()]) . '</dd>'; + $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create, edit, and delete custom blocks of each defined custom block type, from the <a href=":block-library">Custom block library</a>. After creating a block, place it in a region from the <a href=":blocks">Block layout page</a>.', [':blocks' => Url::fromRoute('block.admin_display')->toString(), ':block-library' => Url::fromRoute('entity.block_content.collection')->toString()]) . '</dd>'; $output .= '</dl>'; return $output; @@ -36,10 +36,6 @@ function block_content_help($route_name, RouteMatchInterface $route_match) { $output = '<p>' . t('Blocks in the block library belong to <a href=":types">Custom block types</a>, each with its own fields and display settings. After creating a block, place it in a region from the <a href=":blocks">Block layout</a> page.', [':types' => Url::fromRoute('entity.block_content_type.collection')->toString(), ':blocks' => Url::fromRoute('block.admin_display')->toString()]) . '</p>'; return $output; - case 'entity.block_content_type.collection': - $output = '<p>' . t('Each block type has its own fields and display settings. Create blocks of each type on the <a href=":block-library">Blocks</a> page in the custom block library.', [':block-library' => Url::fromRoute('entity.block_content.collection')->toString()]) . '</p>'; - return $output; - } } diff --git a/core/modules/block_content/block_content.routing.yml b/core/modules/block_content/block_content.routing.yml index 65fc9e1df666ab31fbe924b8eeb7b426c4c84ccb..3f826d61d5412073acb2bb7af2cafa12af67eaa7 100644 --- a/core/modules/block_content/block_content.routing.yml +++ b/core/modules/block_content/block_content.routing.yml @@ -50,7 +50,7 @@ entity.block_content.delete_form: block_content: \d+ 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' diff --git a/core/modules/block_content/src/Entity/BlockContentType.php b/core/modules/block_content/src/Entity/BlockContentType.php index 469dbfa5ae8dcacca3ac750f64eea6711709b011..05b4d48b163e6706f8d20533df87a19bccdd1ac5 100644 --- a/core/modules/block_content/src/Entity/BlockContentType.php +++ b/core/modules/block_content/src/Entity/BlockContentType.php @@ -11,7 +11,7 @@ * @ConfigEntityType( * id = "block_content_type", * label = @Translation("Custom block type"), - * label_collection = @Translation("Custom block library"), + * label_collection = @Translation("Custom block types"), * label_singular = @Translation("custom block type"), * label_plural = @Translation("custom block types"), * label_count = @PluralTranslation( @@ -39,10 +39,10 @@ * "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}", - * "entity-permissions-form" = "/admin/structure/block/block-content/manage/{block_content_type}/permissions", - * "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}", + * "entity-permissions-form" = "/admin/structure/block-content/manage/{block_content_type}/permissions", + * "collection" = "/admin/structure/block-content", * }, * config_export = { * "id", diff --git a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php index 8db7e25a1b60c63705aaae5b5ed9a135884f6077..1b4cc4d15bc6faa96584ee7d9f6fcd9ebe1677ab 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php @@ -111,10 +111,7 @@ public function testBlockContentCreationMultipleViewModes() { $this->submitForm(['region' => 'content'], 'Save block'); // Set test_view_mode as a custom display to be available on the list. - $this->drupalGet('admin/structure/block/block-content'); - $this->drupalGet('admin/structure/block/block-content/types'); - $this->clickLink('Manage display'); - $this->drupalGet('admin/structure/block/block-content/manage/basic/display'); + $this->drupalGet('admin/structure/block-content/manage/basic/display'); $custom_view_mode = [ 'display_modes_custom[test_view_mode]' => 1, ]; diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php index 36d096d809b30b7d01c647812c0faf2d29e368b3..c615992eb399d0f6b5c0e1bbd301af8f31987177 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php @@ -133,15 +133,14 @@ public function testBlockContentTypeEditing() { $edit = [ 'label' => 'Bar', ]; - $this->drupalGet('admin/structure/block/block-content/manage/basic'); + $this->drupalGet('admin/structure/block-content/manage/basic'); $this->assertSession()->titleEquals('Edit basic custom block type | Drupal'); $this->submitForm($edit, 'Save'); $front_page_path = Url::fromRoute('<front>')->toString(); - $this->assertBreadcrumb('admin/structure/block/block-content/manage/basic/fields', [ + $this->assertBreadcrumb('admin/structure/block-content/manage/basic/fields', [ $front_page_path => 'Home', - 'admin/structure/block' => 'Block layout', - 'admin/structure/block/block-content' => 'Custom block library', - 'admin/structure/block/block-content/manage/basic' => 'Edit Bar', + 'admin/structure/block-content' => 'Custom block types', + 'admin/structure/block-content/manage/basic' => 'Edit Bar', ]); \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions(); @@ -152,10 +151,10 @@ public function testBlockContentTypeEditing() { $this->assertSession()->addressEquals(Url::fromRoute('block_content.add_form', ['block_content_type' => 'basic'])); // Remove the body field. - $this->drupalGet('admin/structure/block/block-content/manage/basic/fields/block_content.basic.body/delete'); + $this->drupalGet('admin/structure/block-content/manage/basic/fields/block_content.basic.body/delete'); $this->submitForm([], 'Delete'); // Resave the settings for this type. - $this->drupalGet('admin/structure/block/block-content/manage/basic'); + $this->drupalGet('admin/structure/block-content/manage/basic'); $this->submitForm([], 'Save'); // Check that the body field doesn't exist. $this->drupalGet('block/add/basic'); @@ -177,14 +176,14 @@ 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->assertSession()->pageTextContains($type->label() . ' is used by 1 custom block on your site. You can not remove this block type until you have removed all of the ' . $type->label() . ' blocks.'); $this->assertSession()->pageTextNotContains('This action cannot be undone.'); // 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->assertSession()->pageTextContains('Are you sure you want to delete the custom block type ' . $type->id() . '?'); $this->assertSession()->pageTextContains('This action cannot be undone.'); } diff --git a/core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php b/core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php index 4c407afcc2a73b564de781316bcf68f457b43b00..1d32a54c5fc7aca6d09f8022acf42c3f1979eebc 100644 --- a/core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php +++ b/core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php @@ -64,10 +64,6 @@ public function testBlockContentListLocalTasks($route) { 'block.admin_display', 'entity.block_content.collection', ], - 1 => [ - 'block_content.list_sub', - 'entity.block_content_type.collection', - ], ]); } @@ -76,7 +72,7 @@ public function testBlockContentListLocalTasks($route) { */ public function getBlockContentListingRoutes() { return [ - ['entity.block_content.collection', 'entity.block_content_type.collection'], + ['entity.block_content.collection'], ]; } diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php index 9591438206c8c0a3a12f3479e5f121827f918616..668c0e995056530bd6517a71041e33a8688cd4f9 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php @@ -203,9 +203,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->assertSession()->linkByHrefExists($translate_link); @@ -428,7 +428,7 @@ public function doFieldListTest() { 'field' => 'node.' . $content_type->id() . '.body', ], [ - 'list' => 'admin/structure/block/block-content/manage/basic/fields', + 'list' => 'admin/structure/block-content/manage/basic/fields', 'field' => 'block_content.basic.body', ], ]; diff --git a/core/modules/help_topics/help_topics/block_content.type.html.twig b/core/modules/help_topics/help_topics/block_content.type.html.twig index 1b91c6366fcd6b4f1b7b77edd5cfbc7da5b5dac2..95b2f87948f48635c1070b28ef1222e3eb491f70 100644 --- a/core/modules/help_topics/help_topics/block_content.type.html.twig +++ b/core/modules/help_topics/help_topics/block_content.type.html.twig @@ -9,13 +9,13 @@ related: - field_ui.manage_form - field_ui.manage_display --- -{% set types_link_text %}{% trans %}Block types{% endtrans %}{% endset %} +{% set types_link_text %}{% trans %}Custom block types{% endtrans %}{% endset %} {% set types_link = render_var(help_route_link(types_link_text, 'entity.block_content_type.collection')) %} <h2>{% trans %}Goal{% endtrans %}</h2> <p>{% trans %}Define a custom block type and its fields.{% endtrans %}</p> <h2>{% trans %}Steps{% endtrans %}</h2> <ol> - <li>{% trans %}In the <em>Manage</em> administrative menu, navigate to <em>Structure</em> > <em>Block layout</em> > <em>Custom block library</em> > <em>{{ types_link }}</em>.{% endtrans %}</li> + <li>{% trans %}In the <em>Manage</em> administrative menu, navigate to <em>Structure</em> > <em>{{ types_link }}</em>.{% endtrans %}</li> <li>{% trans %}Click <em>Add custom block type</em>.{% endtrans %}</li> <li>{% trans %}Enter a label for this block type (shown in the administrative interface). Optionally, edit the automatically-generated machine name or the description.{% endtrans %}</li> <li>{% trans %}Click <em>Save</em>. You will be returned to the <em>Block types</em> page.{% endtrans %}</li> diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php index 5db6cba6d4171709d2596de376b8f15bc5973c71..2be06bdde1d773cffc1e4bb35e5a4125f38708bf 100644 --- a/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php +++ b/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php @@ -218,7 +218,7 @@ public function testShortcutQuickLink() { 'revision' => FALSE, ])->save(); // Test page with HTML tags in title. - $this->drupalGet('admin/structure/block/block-content/manage/basic'); + $this->drupalGet('admin/structure/block-content/manage/basic'); $page_title = "Edit Basic block custom block type"; $this->assertSession()->pageTextContains($page_title); // Add shortcut to this page.