From 8c517bf37fc5af8829cbab8bf37aedb349ae189a Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole Date: Fri, 30 Jan 2015 11:48:30 +0000 Subject: [PATCH] Issue #2306407 by lauriii, penyaskito, mortendk, pakmanlh, Wim Leers, ypogue: Remove breadcrumb from page template --- core/includes/theme.inc | 11 ----------- core/lib/Drupal/Core/Extension/ThemeHandler.php | 1 + core/modules/book/src/Tests/BookTest.php | 4 ++++ core/modules/comment/src/Tests/CommentNonNodeTest.php | 6 +++++- .../modules/contact/src/Tests/ContactSitewideTest.php | 10 +++++++++- core/modules/dblog/src/Tests/DbLogTest.php | 6 +++++- .../src/Tests/EntityReferenceAdminTest.php | 6 +++++- core/modules/field_ui/src/Tests/ManageDisplayTest.php | 3 ++- core/modules/field_ui/src/Tests/ManageFieldsTest.php | 3 ++- core/modules/file/src/Tests/FileFieldWidgetTest.php | 10 +++++++++- core/modules/forum/src/Tests/ForumTest.php | 4 ++++ core/modules/link/src/Tests/LinkFieldUITest.php | 6 +++++- core/modules/node/src/Tests/NodeTitleTest.php | 6 +++++- .../src/Tests/Cache/PageCacheTagsIntegrationTest.php | 9 ++++++++- core/modules/system/templates/page.html.twig | 6 ++---- core/modules/taxonomy/src/Tests/TaxonomyTestBase.php | 6 +++++- core/modules/user/src/Tests/Views/AccessTestBase.php | 11 +++++++++++ .../config/install/block.block.bartik_breadcrumbs.yml | 6 +++--- .../config/install/block.block.seven_breadcrumbs.yml | 6 +++--- core/themes/bartik/bartik.info.yml | 1 + core/themes/bartik/css/components/breadcrumb.css | 1 - core/themes/bartik/templates/page.html.twig | 6 ++---- core/themes/seven/seven.info.yml | 1 + core/themes/seven/templates/page.html.twig | 6 ++---- 24 files changed, 94 insertions(+), 41 deletions(-) diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 43d9b8fb4d331c1..ebed077a7fa8fde 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1482,17 +1482,6 @@ function template_preprocess_page(&$variables) { '#theme' => 'status_messages', '#access' => $variables['show_messages'], ); - - // Set the breadcrumb last, so as to increase the chance of being able to - // re-use the cache of an already retrieved menu containing the active link - // for the current page. - // @see menu_tree_page_data() - if (!defined('MAINTENANCE_MODE')) { - $variables['breadcrumb'] = array( - '#theme' => 'breadcrumb', - '#links' => \Drupal::service('breadcrumb')->build(\Drupal::routeMatch()), - ); - } } /** diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index d21e2568dc1b3c5..9529c8a04d1528e 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -468,6 +468,7 @@ class ThemeHandler implements ThemeHandlerInterface { 'help' => 'Help', 'page_top' => 'Page top', 'page_bottom' => 'Page bottom', + 'breadcrumb' => 'Breadcrumb', ), 'description' => '', 'features' => $this->defaultFeatures, diff --git a/core/modules/book/src/Tests/BookTest.php b/core/modules/book/src/Tests/BookTest.php index 0f88dc82f716faa..2e0d95cc489ee89 100644 --- a/core/modules/book/src/Tests/BookTest.php +++ b/core/modules/book/src/Tests/BookTest.php @@ -59,8 +59,12 @@ class BookTest extends WebTestBase { */ protected $webUserWithoutNodeAccess; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); // node_access_test requires a node_access_rebuild(). node_access_rebuild(); diff --git a/core/modules/comment/src/Tests/CommentNonNodeTest.php b/core/modules/comment/src/Tests/CommentNonNodeTest.php index 65271a1a6725dcb..9a9f48e1d789d27 100644 --- a/core/modules/comment/src/Tests/CommentNonNodeTest.php +++ b/core/modules/comment/src/Tests/CommentNonNodeTest.php @@ -25,7 +25,7 @@ class CommentNonNodeTest extends WebTestBase { use FieldUiTestTrait; - public static $modules = array('comment', 'user', 'field_ui', 'entity_test'); + public static $modules = array('comment', 'user', 'field_ui', 'entity_test', 'block'); /** * An administrative user with permission to configure comment settings. @@ -34,8 +34,12 @@ class CommentNonNodeTest extends WebTestBase { */ protected $adminUser; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); // Create a bundle for entity_test. entity_test_create_bundle('entity_test', 'Entity Test', 'entity_test'); diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php index 50e58847509fb3b..b2ff676bb123afc 100644 --- a/core/modules/contact/src/Tests/ContactSitewideTest.php +++ b/core/modules/contact/src/Tests/ContactSitewideTest.php @@ -30,7 +30,15 @@ class ContactSitewideTest extends WebTestBase { * * @var array */ - public static $modules = array('text', 'contact', 'field_ui', 'contact_test'); + public static $modules = array('text', 'contact', 'field_ui', 'contact_test', 'block'); + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); + } /** * Tests configuration options and the site-wide contact form. diff --git a/core/modules/dblog/src/Tests/DbLogTest.php b/core/modules/dblog/src/Tests/DbLogTest.php index 72be622e529dd4e..d6a59ad72f30b0e 100644 --- a/core/modules/dblog/src/Tests/DbLogTest.php +++ b/core/modules/dblog/src/Tests/DbLogTest.php @@ -26,7 +26,7 @@ class DbLogTest extends WebTestBase { * * @var array */ - public static $modules = array('dblog', 'node', 'forum', 'help'); + public static $modules = array('dblog', 'node', 'forum', 'help', 'block'); /** * A user with some relevant administrative permissions. @@ -42,8 +42,12 @@ class DbLogTest extends WebTestBase { */ protected $webUser; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); // Create users with specific permissions. $this->adminUser = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'access site reports', 'administer users')); diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php index 5d75d3fa1603d41..dcd2e5413026f1e 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php @@ -28,7 +28,7 @@ class EntityReferenceAdminTest extends WebTestBase { * * @var array */ - public static $modules = array('node', 'field_ui', 'entity_reference', 'path', 'taxonomy'); + public static $modules = array('node', 'field_ui', 'entity_reference', 'path', 'taxonomy', 'block'); /** @@ -38,8 +38,12 @@ class EntityReferenceAdminTest extends WebTestBase { */ protected $type; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); // Create test user. $admin_user = $this->drupalCreateUser(array('access content', 'administer node fields', 'administer node display')); diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php index 5ba570d9e94f2ff..57cf2aca8fa518e 100644 --- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php @@ -26,13 +26,14 @@ class ManageDisplayTest extends WebTestBase { * * @var array */ - public static $modules = array('node', 'field_ui', 'taxonomy', 'search', 'field_test', 'field_third_party_test'); + public static $modules = array('node', 'field_ui', 'taxonomy', 'search', 'field_test', 'field_third_party_test', 'block'); /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); // Create a test user. $admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer node fields', 'administer node form display', 'administer node display', 'administer taxonomy', 'administer taxonomy_term fields', 'administer taxonomy_term display', 'administer users', 'administer account settings', 'administer user display', 'bypass node access')); diff --git a/core/modules/field_ui/src/Tests/ManageFieldsTest.php b/core/modules/field_ui/src/Tests/ManageFieldsTest.php index 472d59ccaf669aa..cd5ff6b73ff820d 100644 --- a/core/modules/field_ui/src/Tests/ManageFieldsTest.php +++ b/core/modules/field_ui/src/Tests/ManageFieldsTest.php @@ -28,13 +28,14 @@ class ManageFieldsTest extends WebTestBase { * * @var array */ - public static $modules = array('node', 'field_ui', 'field_test', 'taxonomy', 'image'); + public static $modules = array('node', 'field_ui', 'field_test', 'taxonomy', 'image', 'block'); /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); // Create a test user. $admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer node fields', 'administer node form display', 'administer node display', 'administer taxonomy', 'administer taxonomy_term fields', 'administer taxonomy_term display', 'administer users', 'administer account settings', 'administer user display', 'bypass node access')); diff --git a/core/modules/file/src/Tests/FileFieldWidgetTest.php b/core/modules/file/src/Tests/FileFieldWidgetTest.php index c3ce5f05e6bb5f9..4b52a5cc4b5aee8 100644 --- a/core/modules/file/src/Tests/FileFieldWidgetTest.php +++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php @@ -22,12 +22,20 @@ class FileFieldWidgetTest extends FileFieldTestBase { use FieldUiTestTrait; + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); + } + /** * Modules to enable. * * @var array */ - public static $modules = array('comment'); + public static $modules = array('comment', 'block'); /** * Tests upload and remove buttons for a single-valued File field. diff --git a/core/modules/forum/src/Tests/ForumTest.php b/core/modules/forum/src/Tests/ForumTest.php index aff0b859aaf740c..6feb75461c6eeda 100644 --- a/core/modules/forum/src/Tests/ForumTest.php +++ b/core/modules/forum/src/Tests/ForumTest.php @@ -70,8 +70,12 @@ class ForumTest extends WebTestBase { */ protected $nids; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); // Create users. $this->admin_user = $this->drupalCreateUser(array( diff --git a/core/modules/link/src/Tests/LinkFieldUITest.php b/core/modules/link/src/Tests/LinkFieldUITest.php index 3428faa75073b54..847f3c819750787 100644 --- a/core/modules/link/src/Tests/LinkFieldUITest.php +++ b/core/modules/link/src/Tests/LinkFieldUITest.php @@ -25,12 +25,16 @@ class LinkFieldUITest extends WebTestBase { * * @var array */ - public static $modules = ['node', 'link', 'field_ui']; + public static $modules = ['node', 'link', 'field_ui', 'block']; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); $this->drupalLogin($this->drupalCreateUser(['administer content types', 'administer node fields', 'administer node display'])); + $this->drupalPlaceBlock('system_breadcrumb_block'); } /** diff --git a/core/modules/node/src/Tests/NodeTitleTest.php b/core/modules/node/src/Tests/NodeTitleTest.php index 25e2576200acae5..3e3be817e47efa8 100644 --- a/core/modules/node/src/Tests/NodeTitleTest.php +++ b/core/modules/node/src/Tests/NodeTitleTest.php @@ -19,7 +19,7 @@ class NodeTitleTest extends NodeTestBase { * * @var array */ - public static $modules = array('comment', 'views'); + public static $modules = array('comment', 'views', 'block'); /** * A user with permission to bypass access content. @@ -28,8 +28,12 @@ class NodeTitleTest extends NodeTestBase { */ protected $adminUser; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); $this->adminUser = $this->drupalCreateUser(array('administer nodes', 'create article content', 'create page content', 'post comments')); $this->drupalLogin($this->adminUser); diff --git a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php b/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php index c41d2fa84897267..7ce1b5beaf3e9e9 100644 --- a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php +++ b/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php @@ -25,6 +25,9 @@ class PageCacheTagsIntegrationTest extends WebTestBase { protected $dumpHeaders = TRUE; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); @@ -64,7 +67,7 @@ class PageCacheTagsIntegrationTest extends WebTestBase { 'request_path' => array( 'pages' => 'node/' . $node_2->id(), ), - ) + ), )); // Full node page 1. @@ -72,6 +75,7 @@ class PageCacheTagsIntegrationTest extends WebTestBase { 'rendered', 'block_view', 'config:block_list', + 'config:block.block.bartik_breadcrumbs', 'config:block.block.bartik_content', 'config:block.block.bartik_tools', 'config:block.block.bartik_login', @@ -79,6 +83,7 @@ class PageCacheTagsIntegrationTest extends WebTestBase { 'config:block.block.bartik_powered', 'config:block.block.bartik_main_menu', 'config:block.block.bartik_account_menu', + 'block_plugin:system_breadcrumb_block', 'block_plugin:system_main_block', 'block_plugin:system_menu_block__account', 'block_plugin:system_menu_block__main', @@ -101,6 +106,7 @@ class PageCacheTagsIntegrationTest extends WebTestBase { 'rendered', 'block_view', 'config:block_list', + 'config:block.block.bartik_breadcrumbs', 'config:block.block.bartik_content', 'config:block.block.bartik_tools', 'config:block.block.bartik_login', @@ -109,6 +115,7 @@ class PageCacheTagsIntegrationTest extends WebTestBase { 'config:block.block.bartik_powered', 'config:block.block.bartik_main_menu', 'config:block.block.bartik_account_menu', + 'block_plugin:system_breadcrumb_block', 'block_plugin:system_main_block', 'block_plugin:system_menu_block__account', 'block_plugin:system_menu_block__main', diff --git a/core/modules/system/templates/page.html.twig b/core/modules/system/templates/page.html.twig index 88fc563cc017526..627d7c7aeff604b 100644 --- a/core/modules/system/templates/page.html.twig +++ b/core/modules/system/templates/page.html.twig @@ -25,9 +25,6 @@ * - site_slogan: The slogan of the site. This is empty when displaying the site * slogan has been disabled in theme settings. * - * Navigation: - * - breadcrumb: The breadcrumb trail for the current page. - * * Page content (in order of occurrence in the default page.html.twig): * - title_prefix: Additional output populated by modules, intended to be * displayed in front of the main title tag that appears in the template. @@ -54,6 +51,7 @@ * - page.sidebar_first: Items for the first sidebar. * - page.sidebar_second: Items for the second sidebar. * - page.footer: Items for the footer region. + * - page.breadcrumb: Items for the breadcrumb region. * * @see template_preprocess_page() * @see html.html.twig @@ -96,7 +94,7 @@ {{ page.primary_menu }} {{ page.secondary_menu }} - {{ breadcrumb }} + {{ page.breadcrumb }} {{ messages }} diff --git a/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php b/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php index 9a1436cd2a6f32a..c2720ecc50e8718 100644 --- a/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php +++ b/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php @@ -22,10 +22,14 @@ abstract class TaxonomyTestBase extends WebTestBase { * * @var array */ - public static $modules = array('taxonomy'); + public static $modules = array('taxonomy', 'block'); + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); // Create Basic page and Article node types. if ($this->profile != 'standard') { diff --git a/core/modules/user/src/Tests/Views/AccessTestBase.php b/core/modules/user/src/Tests/Views/AccessTestBase.php index 7777b13936875f9..c6822feb4640ca0 100644 --- a/core/modules/user/src/Tests/Views/AccessTestBase.php +++ b/core/modules/user/src/Tests/Views/AccessTestBase.php @@ -12,6 +12,13 @@ namespace Drupal\user\Tests\Views; */ abstract class AccessTestBase extends UserTestBase { + /** + * Modules to enable. + * + * @var array + */ + public static $modules = array('block'); + /** * Contains a user object that has no special permissions. * @@ -40,8 +47,12 @@ abstract class AccessTestBase extends UserTestBase { */ protected $normalRole; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); $this->enableViewsTestModule(); diff --git a/core/profiles/standard/config/install/block.block.bartik_breadcrumbs.yml b/core/profiles/standard/config/install/block.block.bartik_breadcrumbs.yml index c89b7280d0eca54..5589c10d5fcb77e 100644 --- a/core/profiles/standard/config/install/block.block.bartik_breadcrumbs.yml +++ b/core/profiles/standard/config/install/block.block.bartik_breadcrumbs.yml @@ -1,9 +1,9 @@ id: bartik_breadcrumbs theme: bartik -weight: -5 -status: false +weight: 0 +status: true langcode: en -region: '-1' +region: breadcrumb plugin: system_breadcrumb_block settings: id: system_breadcrumb_block diff --git a/core/profiles/standard/config/install/block.block.seven_breadcrumbs.yml b/core/profiles/standard/config/install/block.block.seven_breadcrumbs.yml index 8ce13d8e990e655..fc95b026f35d856 100644 --- a/core/profiles/standard/config/install/block.block.seven_breadcrumbs.yml +++ b/core/profiles/standard/config/install/block.block.seven_breadcrumbs.yml @@ -1,9 +1,9 @@ id: seven_breadcrumbs theme: seven -weight: -2 -status: false +weight: 0 +status: true langcode: en -region: '-1' +region: breadcrumb plugin: system_breadcrumb_block settings: id: system_breadcrumb_block diff --git a/core/themes/bartik/bartik.info.yml b/core/themes/bartik/bartik.info.yml index 45e198527c0a4bf..3588bc81f9db8a9 100644 --- a/core/themes/bartik/bartik.info.yml +++ b/core/themes/bartik/bartik.info.yml @@ -22,6 +22,7 @@ regions: page_top: 'Page top' page_bottom: 'Page bottom' featured: Featured + breadcrumb: Breadcrumb content: Content sidebar_first: 'Sidebar first' sidebar_second: 'Sidebar second' diff --git a/core/themes/bartik/css/components/breadcrumb.css b/core/themes/bartik/css/components/breadcrumb.css index 607d3fc5eb620d1..76f0695ee2998c7 100644 --- a/core/themes/bartik/css/components/breadcrumb.css +++ b/core/themes/bartik/css/components/breadcrumb.css @@ -5,5 +5,4 @@ .breadcrumb { font-size: 0.929em; - margin: 0 15px; } diff --git a/core/themes/bartik/templates/page.html.twig b/core/themes/bartik/templates/page.html.twig index acf7b3dfea3b8b1..518969a3f9d0e8e 100644 --- a/core/themes/bartik/templates/page.html.twig +++ b/core/themes/bartik/templates/page.html.twig @@ -32,9 +32,6 @@ * on the theme settings page. If hidden, the "visually-hidden" class is * added to make the site slogan visually hidden, but still accessible. * - * Navigation: - * - breadcrumb: The breadcrumb trail for the current page. - * * Page content (in order of occurrence in the default page.html.twig): * - title_prefix: Additional output populated by modules, intended to be * displayed in front of the main title tag that appears in the template. @@ -68,6 +65,7 @@ * - page.footer_thirdcolumn: Items for the third footer column. * - page.footer_fourthcolumn: Items for the fourth footer column. * - page.footer: Items for the footer region. + * - page.breadcrumb: Items for the breadcrumb region. * * @see template_preprocess_page() * @see bartik_preprocess_page() @@ -125,7 +123,7 @@ {% endif %}
- {{ breadcrumb }} + {{ page.breadcrumb }}
diff --git a/core/themes/seven/seven.info.yml b/core/themes/seven/seven.info.yml index 0f605b69dfd1c34..945ceacd95fbcc9 100644 --- a/core/themes/seven/seven.info.yml +++ b/core/themes/seven/seven.info.yml @@ -23,5 +23,6 @@ regions: page_top: 'Page top' page_bottom: 'Page bottom' sidebar_first: 'First sidebar' + breadcrumb: Breadcrumb regions_hidden: - sidebar_first diff --git a/core/themes/seven/templates/page.html.twig b/core/themes/seven/templates/page.html.twig index b2cc0bfb9dd5c6b..fc3c7d4a0e88c56 100644 --- a/core/themes/seven/templates/page.html.twig +++ b/core/themes/seven/templates/page.html.twig @@ -26,9 +26,6 @@ * - site_slogan: The slogan of the site. This is empty when displaying the site * slogan has been disabled in theme settings. * - * Navigation: - * - breadcrumb: The breadcrumb trail for the current page. - * * Page content (in order of occurrence in the default page.html.twig): * - title_prefix: Additional output populated by modules, intended to be * displayed in front of the main title tag that appears in the template. @@ -53,6 +50,7 @@ * - page.sidebar_first: Items for the first sidebar. * - page.sidebar_second: Items for the second sidebar. * - page.page_bottom: Items for the footer region. + * - page.breadcrumb: Items for the breadcrumb region. * * @see template_preprocess_page() * @see seven_preprocess_page() @@ -77,7 +75,7 @@ {% endif %} - {{ breadcrumb }} + {{ page.breadcrumb }}