diff --git a/core/modules/block/src/Tests/BlockLanguageCacheTest.php b/core/modules/block/src/Tests/BlockLanguageCacheTest.php
index 45f6803..e53987f 100644
--- a/core/modules/block/src/Tests/BlockLanguageCacheTest.php
+++ b/core/modules/block/src/Tests/BlockLanguageCacheTest.php
@@ -59,9 +59,12 @@ public function testBlockLinks() {
));
$this->drupalLogin($admin_user);
+ // Get the default theme
+ $theme = $this->config('system.theme')->get('default');
+
// Create the block cache for all languages.
foreach ($this->langcodes as $langcode) {
- $this->drupalGet('admin/structure/block', array('language' => $langcode));
+ $this->drupalGet("admin/structure/block/list/$theme/add", array('language' => $langcode));
}
// Create a menu in the default language.
@@ -72,7 +75,7 @@ public function testBlockLinks() {
// Check that the block is listed for all languages.
foreach ($this->langcodes as $langcode) {
- $this->drupalGet('admin/structure/block', array('language' => $langcode));
+ $this->drupalGet("admin/structure/block/list/$theme/add", array('language' => $langcode));
$this->assertText($edit['label']);
}
}
diff --git a/core/modules/block/src/Tests/BlockUiTest.php b/core/modules/block/src/Tests/BlockUiTest.php
index aba4ba1..99b4534 100644
--- a/core/modules/block/src/Tests/BlockUiTest.php
+++ b/core/modules/block/src/Tests/BlockUiTest.php
@@ -133,14 +133,16 @@ function testBlockAdminUiPage() {
*/
public function testCandidateBlockList() {
$arguments = array(
- ':ul_class' => 'block-list',
- ':li_class' => 'test-block-instantiation',
- ':href' => 'admin/structure/block/add/test_block_instantiation/classy',
- ':text' => 'Display message',
+ ':title' => 'Display message',
+ ':category' => 'Block test',
);
+ // Get the default theme
+// $theme = $this->config('system.theme')->get('default');
+// $this->drupalGet("admin/structure/block/list/$theme/add");
$this->drupalGet('admin/structure/block');
- $elements = $this->xpath('//details[@id="edit-category-block-test"]//ul[contains(@class, :ul_class)]/li[contains(@class, :li_class)]/a[contains(@href, :href) and text()=:text]', $arguments);
+ $this->clickLink(t('Add block to layout'));
+ $elements = $this->xpath('//tr[.//td/div[text()=:title] and .//td[text()=:category]]', $arguments);
$this->assertTrue(!empty($elements), 'The test block appears in the category for its module.');
// Trigger the custom category addition in block_test_block_alter().
@@ -148,7 +150,9 @@ public function testCandidateBlockList() {
$this->container->get('plugin.manager.block')->clearCachedDefinitions();
$this->drupalGet('admin/structure/block');
- $elements = $this->xpath('//details[@id="edit-category-custom-category"]//ul[contains(@class, :ul_class)]/li[contains(@class, :li_class)]/a[contains(@href, :href) and text()=:text]', $arguments);
+ $this->clickLink(t('Add block to layout'));
+ $arguments[':category'] = "Custom category";
+ $elements = $this->xpath('//tr[.//td/div[text()=:title] and .//td[text()=:category]]', $arguments);
$this->assertTrue(!empty($elements), 'The test block appears in a custom category controlled by block_test_block_alter().');
}
diff --git a/core/modules/block/src/Tests/BlockXssTest.php b/core/modules/block/src/Tests/BlockXssTest.php
index f24811a..67f9036 100644
--- a/core/modules/block/src/Tests/BlockXssTest.php
+++ b/core/modules/block/src/Tests/BlockXssTest.php
@@ -50,9 +50,9 @@ protected function doViewTest() {
$view->addDisplay('block');
$view->save();
- $this->drupalGet(Url::fromRoute('block.admin_display'));
- $this->clickLink('');
- $this->assertRaw('<script>alert("view");</script>');
+ $route_options = array('theme' => $this->config('system.theme')->get('default'));
+ $this->drupalGet(Url::fromRoute('block.admin_layout_add', $route_options));
+ $this->assertRaw('alert("view");');
$this->assertNoRaw('');
}
@@ -65,9 +65,9 @@ protected function doMenuTest() {
'label' => '',
])->save();
- $this->drupalGet(Url::fromRoute('block.admin_display'));
- $this->clickLink('');
- $this->assertRaw('<script>alert("menu");</script>');
+ $route_options = array('theme' => $this->config('system.theme')->get('default'));
+ $this->drupalGet(Url::fromRoute('block.admin_layout_add', $route_options));
+ $this->assertRaw('alert("menu");');
$this->assertNoRaw('');
}
@@ -85,9 +85,9 @@ protected function doBlockContentTest() {
'info' => '',
])->save();
- $this->drupalGet(Url::fromRoute('block.admin_display'));
- $this->clickLink('');
- $this->assertRaw('<script>alert("block_content");</script>');
+ $route_options = array('theme' => $this->config('system.theme')->get('default'));
+ $this->drupalGet(Url::fromRoute('block.admin_layout_add', $route_options));
+ $this->assertRaw('alert("block_content");');
$this->assertNoRaw('');
}
diff --git a/core/modules/block_content/block_content.links.action.yml b/core/modules/block_content/block_content.links.action.yml
index b55361a..d94ca3f 100644
--- a/core/modules/block_content/block_content.links.action.yml
+++ b/core/modules/block_content/block_content.links.action.yml
@@ -8,5 +8,7 @@ block_content_add_action:
route_name: block_content.add_page
title: 'Add custom block'
appears_on:
+ - block.admin_display
+ - block.admin_display_theme
- entity.block_content.collection
class: \Drupal\block_content\Plugin\Menu\LocalAction\BlockContentAddLocalAction
diff --git a/core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php b/core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php
index 62e0c3c..bdf163d 100644
--- a/core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php
+++ b/core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php
@@ -8,8 +8,10 @@
namespace Drupal\block_content\Plugin\Menu\LocalAction;
use Drupal\Core\Menu\LocalActionDefault;
+use Drupal\Core\Routing\RouteMatch;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Routing\UrlGeneratorTrait;
+use Symfony\Component\HttpFoundation\Request;
/**
* Modifies the 'Add custom block' local action.
@@ -33,4 +35,22 @@ public function getOptions(RouteMatchInterface $route_match) {
return $options;
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getTitle(Request $request = NULL) {
+ $route_match = RouteMatch::createFromRequest($request);
+
+ switch ($route_match->getRouteName()) {
+ case 'block.admin_display':
+ case 'block.admin_display_theme':
+ return $this->t('Add new custom block to layout');
+ break;
+
+ default:
+ return parent::getTitle($request);
+ break;
+ }
+ }
+
}
diff --git a/core/modules/block_content/src/Tests/BlockContentListTest.php b/core/modules/block_content/src/Tests/BlockContentListTest.php
index aeed4dc..30d1585 100644
--- a/core/modules/block_content/src/Tests/BlockContentListTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentListTest.php
@@ -33,7 +33,7 @@ public function testListing() {
$this->drupalGet('admin/structure/block/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/BlockContentTypeTest.php b/core/modules/block_content/src/Tests/BlockContentTypeTest.php
index 4270538..14b6760 100644
--- a/core/modules/block_content/src/Tests/BlockContentTypeTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentTypeTest.php
@@ -189,7 +189,7 @@ public function testsBlockContentAddTypes() {
// block configure form.
$path = $theme == $default_theme ? 'admin/structure/block' : "admin/structure/block/list/$theme";
$this->drupalGet($path);
- $this->clickLink(t('Add custom block'));
+ $this->clickLink(t('Add new custom block to layout'));
// The seven theme has markup inside the link, we cannot use clickLink().
if ($default_theme == 'seven') {
$options = $theme != $default_theme ? array('query' => array('theme' => $theme)) : array();