diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 2c8f3fd..baeabf6 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1470,17 +1470,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 8beb184..36c286e 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -460,6 +460,7 @@ public function rebuildThemeData() { 'help' => 'Help', 'page_top' => 'Page top', 'page_bottom' => 'Page bottom', + 'breadcrumb' => 'Breadcrumb', ), 'description' => '', 'features' => $this->defaultFeatures, diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index 511cefb..eb2306a 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -76,6 +76,7 @@ public function getFunctions() { new \Twig_SimpleFunction('path', array($this, 'getPath'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))), new \Twig_SimpleFunction('url_from_path', array($this, 'getUrlFromPath'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))), new \Twig_SimpleFunction('link', array($this, 'getLink')), + new \Twig_SimpleFunction('file_url', 'file_create_url'), ); } diff --git a/core/modules/book/src/Tests/BookTest.php b/core/modules/book/src/Tests/BookTest.php index 44c71ec..0f349b1 100644 --- a/core/modules/book/src/Tests/BookTest.php +++ b/core/modules/book/src/Tests/BookTest.php @@ -52,8 +52,12 @@ class BookTest extends WebTestBase { */ protected $adminUser; + /** + * {@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 9189d42..985760b 100644 --- a/core/modules/comment/src/Tests/CommentNonNodeTest.php +++ b/core/modules/comment/src/Tests/CommentNonNodeTest.php @@ -24,7 +24,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. @@ -33,8 +33,12 @@ class CommentNonNodeTest extends WebTestBase { */ protected $admin_user; + /** + * {@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 1909a46..0bc7214 100644 --- a/core/modules/contact/src/Tests/ContactSitewideTest.php +++ b/core/modules/contact/src/Tests/ContactSitewideTest.php @@ -28,7 +28,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 ec34a6c..48022c1 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 a13a75b..45b2005 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 e628757..755302e 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 335b63b..06d6f8f 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 c3ce5f0..4b52a5c 100644 --- a/core/modules/file/src/Tests/FileFieldWidgetTest.php +++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php @@ -23,11 +23,19 @@ 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 c716f5a..ffbeaed 100644 --- a/core/modules/forum/src/Tests/ForumTest.php +++ b/core/modules/forum/src/Tests/ForumTest.php @@ -67,8 +67,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 1f7c3c1..9c3413a 100644 --- a/core/modules/link/src/Tests/LinkFieldUITest.php +++ b/core/modules/link/src/Tests/LinkFieldUITest.php @@ -25,10 +25,14 @@ class LinkFieldUITest extends WebTestBase { * * @var array */ - public static $modules = array('node', 'link', 'field_ui'); + public static $modules = array('node', 'link', 'field_ui', 'block'); + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); $this->web_user = $this->drupalCreateUser(array('administer content types', 'administer node fields', 'administer node display')); $this->drupalLogin($this->web_user); diff --git a/core/modules/node/src/Tests/NodeTitleTest.php b/core/modules/node/src/Tests/NodeTitleTest.php index d692be5..aff7b0b 100644 --- a/core/modules/node/src/Tests/NodeTitleTest.php +++ b/core/modules/node/src/Tests/NodeTitleTest.php @@ -19,12 +19,16 @@ class NodeTitleTest extends NodeTestBase { * * @var array */ - public static $modules = array('comment', 'views'); + public static $modules = array('comment', 'views', 'block'); protected $admin_user; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_breadcrumb_block'); $this->admin_user = $this->drupalCreateUser(array('administer nodes', 'create article content', 'create page content', 'post comments')); $this->drupalLogin($this->admin_user); diff --git a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php b/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php index 0109bf1..0c22bdc 100644 --- a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php +++ b/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php @@ -72,6 +72,7 @@ function testPageCacheTags() { 'theme:bartik', 'theme_global_settings', 'block_view', + 'block:bartik_breadcrumbs', 'block:bartik_content', 'block:bartik_tools', 'block:bartik_login', @@ -79,6 +80,7 @@ function testPageCacheTags() { 'block:bartik_powered', 'block:bartik_main_menu', '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', @@ -102,6 +104,7 @@ function testPageCacheTags() { 'theme:bartik', 'theme_global_settings', 'block_view', + 'block:bartik_breadcrumbs', 'block:bartik_content', 'block:bartik_tools', 'block:bartik_login', @@ -110,6 +113,7 @@ function testPageCacheTags() { 'block:bartik_powered', 'block:bartik_main_menu', '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/src/Tests/Theme/EngineTwigTest.php b/core/modules/system/src/Tests/Theme/EngineTwigTest.php index acfd1d1..ecd8d12 100644 --- a/core/modules/system/src/Tests/Theme/EngineTwigTest.php +++ b/core/modules/system/src/Tests/Theme/EngineTwigTest.php @@ -65,7 +65,7 @@ public function testTwigUrlGenerator() { } /** - * Tests the link_generator twig functions. + * Tests the link_generator Twig functions. */ public function testTwigLinkGenerator() { $this->drupalGet('twig-theme-test/link-generator'); @@ -83,4 +83,13 @@ public function testTwigLinkGenerator() { } } + /** + * Tests the file url Twig functions. + */ + public function testTwigFileUrls() { + $this->drupalGet('/twig-theme-test/file-url'); + $filepath = file_create_url('core/assets/vendor/jquery/jquery.js'); + $this->assertRaw('