summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2014-04-16 03:46:05 (GMT)
committerwebchick2014-04-16 03:46:05 (GMT)
commit0a85def4cfb986c5da339132609f99a6159fc7f9 (patch)
tree1758c8109fc655f900ddf8525c0db2e0be700b9d
parentbd4b9ae284f663eaaf9aaf0c2826569003ed01f5 (diff)
Issue #214760 by Jalandhar, lokapujya, dcam, naquah: Theme name in block admin shows HTML entities: excessive check_plain().
-rw-r--r--core/modules/block/block.module2
-rw-r--r--core/modules/block/lib/Drupal/block/Tests/BlockTest.php20
-rw-r--r--core/modules/block/tests/modules/block_test/block_test.module9
-rw-r--r--core/modules/block/tests/modules/block_test/themes/cat_mouse/cat_mouse.info.yml16
4 files changed, 46 insertions, 1 deletions
diff --git a/core/modules/block/block.module b/core/modules/block/block.module
index 183462e..5190436 100644
--- a/core/modules/block/block.module
+++ b/core/modules/block/block.module
@@ -62,7 +62,7 @@ function block_help($path, $arg) {
}
$themes = list_themes();
$output = '<p>' . t('This page provides a drag-and-drop interface for adding a block to a region, and for controlling the order of blocks within regions. To add a block to a region, or to configure its specific title and visibility settings, click the block title under <em>Place blocks</em>. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the <em>Save blocks</em> button at the bottom of the page.') . '</p>';
- $output .= '<p>' . l(t('Demonstrate block regions (@theme)', array('@theme' => $themes[$demo_theme]->info['name'])), 'admin/structure/block/demo/' . $demo_theme) . '</p>';
+ $output .= '<p>' . l(t('Demonstrate block regions (!theme)', array('!theme' => $themes[$demo_theme]->info['name'])), 'admin/structure/block/demo/' . $demo_theme) . '</p>';
return $output;
}
}
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
index 37074cc..1a0fd00 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
@@ -182,6 +182,26 @@ class BlockTest extends BlockTestBase {
}
/**
+ * Test block display of theme titles.
+ */
+ function testThemeName() {
+ \Drupal::moduleHandler()->install(array('block_test'));
+ // Explicitly set the default and admin themes.
+ $theme = 'cat_mouse';
+ theme_enable(array($theme, 'seven', 'block_test_theme'));
+ $this->resetAll();
+
+ \Drupal::config('system.theme')
+ ->set('default', 'seven')
+ ->set('admin', 'seven')
+ ->save();
+ \Drupal::service('router.builder')->rebuild();
+ $this->drupalGet('admin/appearance');
+ $this->drupalGet('admin/structure/block');
+ $this->assertText('&lt;&quot;Cat&quot; &amp; &#039;Mouse&#039;&gt;');
+ }
+
+ /**
* Test block title display settings.
*/
function testHideBlockTitle() {
diff --git a/core/modules/block/tests/modules/block_test/block_test.module b/core/modules/block/tests/modules/block_test/block_test.module
index a527ae1..726043c 100644
--- a/core/modules/block/tests/modules/block_test/block_test.module
+++ b/core/modules/block/tests/modules/block_test/block_test.module
@@ -8,6 +8,15 @@
use Drupal\block\BlockPluginInterface;
/**
+ * Implements hook_system_theme_info().
+ */
+function block_test_system_theme_info() {
+ $themes['block_test_theme'] = drupal_get_path('module', 'block_test') . '/themes/block_test_theme/block_test_theme.info.yml';
+ $themes['cat_mouse'] = drupal_get_path('module', 'block_test') . '/themes/cat_mouse/cat_mouse.info.yml';
+ return $themes;
+}
+
+/**
* Implements hook_block_alter().
*/
function block_test_block_alter(&$block_info) {
diff --git a/core/modules/block/tests/modules/block_test/themes/cat_mouse/cat_mouse.info.yml b/core/modules/block/tests/modules/block_test/themes/cat_mouse/cat_mouse.info.yml
new file mode 100644
index 0000000..999f7f3
--- /dev/null
+++ b/core/modules/block/tests/modules/block_test/themes/cat_mouse/cat_mouse.info.yml
@@ -0,0 +1,16 @@
+name: '<"Cat" & ''Mouse''>'
+type: theme
+description: 'Theme for testing special characters in block admin.'
+core: 8.x
+hidden: true
+regions:
+ sidebar_first: 'Left sidebar'
+ sidebar_second: 'Right sidebar'
+ content: Content
+ header: Header
+ footer: Footer
+ highlighted: Highlighted
+ help: Help
+regions_hidden:
+ - sidebar_first
+ - sidebar_second