summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2014-07-07 12:27:39 (GMT)
committerAlex Pott2014-07-07 12:27:39 (GMT)
commit69fd4ce1f72bfdbf8aed979560306fc0cbeac0d8 (patch)
tree71390f2381b14864df02fedab2e10372f035e26c
parentc06901ff39a2efe350cc2886b456a56e911248c0 (diff)
Issue #2277117 by duellj, ivanjaros: BlockListBuilder uses href for links instead of route.
-rw-r--r--core/modules/block/src/BlockListBuilder.php6
-rw-r--r--core/modules/block/src/Tests/Views/DisplayBlockTest.php15
2 files changed, 17 insertions, 4 deletions
diff --git a/core/modules/block/src/BlockListBuilder.php b/core/modules/block/src/BlockListBuilder.php
index 982f962..1bf034d 100644
--- a/core/modules/block/src/BlockListBuilder.php
+++ b/core/modules/block/src/BlockListBuilder.php
@@ -355,7 +355,11 @@ class BlockListBuilder extends ConfigEntityListBuilder implements FormInterface
}
$form['place_blocks']['list'][$category_key]['content']['#links'][$plugin_id] = array(
'title' => $plugin_definition['admin_label'],
- 'href' => 'admin/structure/block/add/' . $plugin_id . '/' . $this->theme,
+ 'route_name' => 'block.admin_add',
+ 'route_parameters' => array(
+ 'plugin_id' => $plugin_id,
+ 'theme' => $this->theme
+ ),
'attributes' => array(
'class' => array('use-ajax', 'block-filter-text-source'),
'data-accepts' => 'application/vnd.drupal-modal',
diff --git a/core/modules/block/src/Tests/Views/DisplayBlockTest.php b/core/modules/block/src/Tests/Views/DisplayBlockTest.php
index 2037a02..1366f39 100644
--- a/core/modules/block/src/Tests/Views/DisplayBlockTest.php
+++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php
@@ -71,7 +71,10 @@ class DisplayBlockTest extends ViewTestBase {
$arguments = array(
':id' => 'edit-category-lists-views',
':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-1',
- ':href' => url('admin/structure/block/add/views_block:' . $edit['id'] . '-block_1/stark'),
+ ':href' => \Drupal::Url('block.admin_add', array(
+ 'plugin_id' => 'views_block:' . $edit['id'] . '-block_1',
+ 'theme' => 'stark',
+ )),
':text' => $edit['label'],
);
$this->drupalGet('admin/structure/block');
@@ -107,7 +110,10 @@ class DisplayBlockTest extends ViewTestBase {
$arguments = array(
':id' => 'edit-category-lists-views',
':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-2',
- ':href' => url('admin/structure/block/add/views_block:' . $edit['id'] . '-block_2/stark'),
+ ':href' => \Drupal::Url('block.admin_add', array(
+ 'plugin_id' => 'views_block:' . $edit['id'] . '-block_2',
+ 'theme' => 'stark',
+ )),
':text' => $edit['label'],
);
$elements = $this->xpath('//details[@id=:id]//li[contains(@class, :li_class)]/a[contains(@href, :href) and text()=:text]', $arguments);
@@ -116,7 +122,10 @@ class DisplayBlockTest extends ViewTestBase {
$arguments = array(
':id' => $category_id,
':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-3',
- ':href' => url('admin/structure/block/add/views_block:' . $edit['id'] . '-block_3/stark'),
+ ':href' => \Drupal::Url('block.admin_add', array(
+ 'plugin_id' => 'views_block:' . $edit['id'] . '-block_3',
+ 'theme' => 'stark',
+ )),
':text' => $edit['label'],
);
$elements = $this->xpath('//details[@id=:id]//li[contains(@class, :li_class)]/a[contains(@href, :href) and text()=:text]', $arguments);