Issue #3199730 by mohit_aghera, Abhijith S, AJV009, Gauravmahlawat, shriaas2898, pameeela, roman-yrv, ranjith_kumar_k_u, Kumar Ashutosh, ilgnerfagundes: Views block description is double-escaped if display name is set

merge-requests/435/head
Lee Rowlands 2021-03-17 07:56:42 +10:00
parent d8cb0aa2f5
commit fd9f7081cb
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
4 changed files with 191 additions and 2 deletions

View File

@ -161,7 +161,7 @@ trait BlockPluginTrait {
$form['admin_label'] = [
'#type' => 'item',
'#title' => $this->t('Block description'),
'#plain_text' => $definition['admin_label'],
'#markup' => $definition['admin_label'],
];
$form['label'] = [
'#type' => 'textfield',

View File

@ -60,7 +60,7 @@ class BlockInterfaceTest extends KernelTestBase {
'admin_label' => [
'#type' => 'item',
'#title' => t('Block description'),
'#plain_text' => $definition['admin_label'],
'#markup' => $definition['admin_label'],
],
'label' => [
'#type' => 'textfield',

View File

@ -0,0 +1,179 @@
langcode: en
status: true
dependencies:
module:
- node
- user
id: articles_and_pages
label: 'Articles and Pages'
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: nid
display:
default:
display_plugin: default
id: default
display_title: Default
position: 0
display_options:
access:
type: perm
options:
perm: 'access content'
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: some
options:
items_per_page: 5
offset: 0
style:
type: default
row:
type: fields
fields:
title:
id: title
table: node_field_data
field: title
settings:
link_to_entity: true
plugin_id: field
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
filters:
status:
value: '1'
table: node_field_data
field: status
plugin_id: boolean
entity_type: node
entity_field: status
id: status
expose:
operator: ''
operator_limit_selection: false
operator_list: { }
group: 1
sorts:
created:
id: created
table: node_field_data
field: created
order: DESC
entity_type: node
entity_field: created
plugin_id: date
relationship: none
group_type: group
admin_label: ''
exposed: false
expose:
label: ''
granularity: second
title: 'Articles and Pages'
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- 'user.node_grants:view'
- user.permissions
tags: { }
block_1:
display_plugin: block
id: block_1
display_title: 'Articles & Pages'
position: 1
display_options:
display_extenders: { }
display_description: ''
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- 'user.node_grants:view'
- user.permissions
tags: { }

View File

@ -46,4 +46,14 @@ class XssTest extends UITestBase {
$this->assertSession()->assertNoEscaped('<');
}
/**
* Test properly escaped characters in description when views block title
* contains special characters.
*/
public function testEscapedBlockDescription() {
// Visit the block placement URL directly and validate block description.
$this->drupalGet('admin/structure/block/add/views_block%3Aarticles_and_pages-block_1/' . $this->config('system.theme')->get('default') . '?region=content');
$this->assertSession()->pageTextContains('Articles and Pages: Articles & Pages');
}
}