core/modules/views/src/Tests/FieldApiDataTest.php | 5 ++--- core/modules/views/views.views.inc | 20 ++++++++++---------- core/modules/views_ui/src/Tests/HandlerTest.php | 15 ++++++--------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/core/modules/views/src/Tests/FieldApiDataTest.php b/core/modules/views/src/Tests/FieldApiDataTest.php index fbfdf00..f1c1bae 100644 --- a/core/modules/views/src/Tests/FieldApiDataTest.php +++ b/core/modules/views/src/Tests/FieldApiDataTest.php @@ -33,13 +33,12 @@ protected function setUp() { // Attach the same field to a different bundle with a different label. $this->drupalCreateContentType(['type' => 'article']); - $field = FieldConfig::create([ + FieldConfig::create([ 'field_name' => $field_names[0], 'entity_type' => 'node', 'bundle' => 'article', 'label' => 'The giraffe2" label' - ]); - $field->save(); + ])->save(); // Now create some example nodes/users for the view result. for ($i = 0; $i < 5; $i++) { diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc index 703e004..6c9fa5c 100644 --- a/core/modules/views/views.views.inc +++ b/core/modules/views/views.views.inc @@ -453,7 +453,7 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora // loses safeness when imploded. The help text is used in #description // and therefore XSS admin filtered by default. Escaped HTML is not // altered by XSS filtering, therefore it is safe to just concatenate the - // strings. Ideally the result would also by marked safe so that, if the + // strings. Ideally the result would also be marked safe so that, if the // string is used in another context it would not be escaped again. // Considering the dual use of this help data (both as metadata and as // help text), other patterns such as use of #markup would not be correct @@ -559,15 +559,15 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora } if ($aliases) { $data[$table_alias][$column_real_name]['aliases'] = $aliases; - // The $also_known variable contains markup that is HTML escaped and that - // loses safeness when imploded. In order to undo the previous escaping, - // we perform a htmlspecialchars_decode() and rely on auto-escape to re- - // escape the data on output. We do this here because what we are putting - // into the help key of the field is schema-like plain-text data that is - // not supposed to contain any markup, while t() outputs HTML data by - // default. Considering the dual use of this help data (both as metadata - // and as help text), other patterns such as use of #markup would not be - // correct here. + // The $also_known variable contains markup that is HTML escaped and + // that loses safeness when imploded. In order to undo the previous + // escaping, we perform a htmlspecialchars_decode() and rely on auto- + // escape to re-escape the data on output. We do this here because what + // we are putting into the help key of the field is schema-like plain- + // text data that is not supposed to contain any markup, while t() + // outputs HTML data by default. Considering the dual use of this help + // data (both as metadata and as help text), other patterns such as use + // of #markup would not be correct here. $also_known_list = htmlspecialchars_decode(implode(', ', $also_known), ENT_QUOTES | ENT_SUBSTITUTE); $data[$table_alias][$column_real_name]['help'] .= ' ' . t('Also known as:') . ' ' . $also_known_list; } diff --git a/core/modules/views_ui/src/Tests/HandlerTest.php b/core/modules/views_ui/src/Tests/HandlerTest.php index b2110a3..6f1ed39 100644 --- a/core/modules/views_ui/src/Tests/HandlerTest.php +++ b/core/modules/views_ui/src/Tests/HandlerTest.php @@ -149,28 +149,25 @@ public function testHandlerHelpEscaping() { $this->drupalCreateContentType(['type' => 'article']); $this->drupalCreateContentType(['type' => 'page']); - $field_storage = FieldStorageConfig::create([ + FieldStorageConfig::create([ 'field_name' => 'field_test', 'entity_type' => 'node', 'type' => 'string', - ]); - $field_storage->save(); + ])->save(); - $field_config = FieldConfig::create([ + FieldConfig::create([ 'field_name' => 'field_test', 'entity_type' => 'node', 'bundle' => 'page', 'label' => 'The giraffe" label' - ]); - $field_config->save(); + ])->save(); - $field_config = FieldConfig::create([ + FieldConfig::create([ 'field_name' => 'field_test', 'entity_type' => 'node', 'bundle' => 'article', 'label' => 'The giraffe" label ' - ]); - $field_config->save(); + ])->save(); $this->drupalGet('admin/structure/views/nojs/add-handler/content/default/field'); $this->assertEscaped('Appears in: page, article. Also known as: Content: The giraffe" label ');