summaryrefslogtreecommitdiffstats
path: root/core/modules/views_ui
diff options
context:
space:
mode:
authorNathaniel Catchpole2018-05-01 15:14:09 (GMT)
committerNathaniel Catchpole2018-05-01 15:14:09 (GMT)
commit45bc05523f1b1adf0962a5b2947edb8cdec9371d (patch)
treea31e26b2c91075ef9c89a157fa0380eae4c1e8e9 /core/modules/views_ui
parent2e8be78f7f54c3a2949780b9b1ed30e27ef5874a (diff)
Issue #2958429 by alexpott: Properly deprecate SafeMarkup::format()
Diffstat (limited to 'core/modules/views_ui')
-rw-r--r--core/modules/views_ui/src/Form/Ajax/Rearrange.php4
-rw-r--r--core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php4
-rw-r--r--core/modules/views_ui/src/ViewEditForm.php8
-rw-r--r--core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php10
-rw-r--r--core/modules/views_ui/tests/src/Functional/DisplayTest.php4
-rw-r--r--core/modules/views_ui/tests/src/Functional/HandlerTest.php6
-rw-r--r--core/modules/views_ui/views_ui.theme.inc6
7 files changed, 21 insertions, 21 deletions
diff --git a/core/modules/views_ui/src/Form/Ajax/Rearrange.php b/core/modules/views_ui/src/Form/Ajax/Rearrange.php
index 6f6834d..b2b1e8e 100644
--- a/core/modules/views_ui/src/Form/Ajax/Rearrange.php
+++ b/core/modules/views_ui/src/Form/Ajax/Rearrange.php
@@ -2,7 +2,7 @@
namespace Drupal\views_ui\Form\Ajax;
-use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\views\ViewEntityInterface;
@@ -126,7 +126,7 @@ class Rearrange extends ViewsFormBase {
'#id' => 'views-removed-' . $id,
'#attributes' => ['class' => ['views-remove-checkbox']],
'#default_value' => 0,
- '#suffix' => \Drupal::l(SafeMarkup::format('<span>@text</span>', ['@text' => $this->t('Remove')]),
+ '#suffix' => \Drupal::l(new FormattableMarkup('<span>@text</span>', ['@text' => $this->t('Remove')]),
Url::fromRoute('<none>', [], [
'attributes' => [
'id' => 'views-remove-link-' . $id,
diff --git a/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php b/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php
index c9ad413..81eb6f2 100644
--- a/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php
+++ b/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php
@@ -2,7 +2,7 @@
namespace Drupal\views_ui\Form\Ajax;
-use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
@@ -117,7 +117,7 @@ class ReorderDisplays extends ViewsFormBase {
],
'link' => [
'#type' => 'link',
- '#title' => SafeMarkup::format('<span>@text</span>', ['@text' => $this->t('Remove')]),
+ '#title' => new FormattableMarkup('<span>@text</span>', ['@text' => $this->t('Remove')]),
'#url' => Url::fromRoute('<none>'),
'#attributes' => [
'id' => 'display-remove-link-' . $id,
diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php
index 124795a..3ca4885 100644
--- a/core/modules/views_ui/src/ViewEditForm.php
+++ b/core/modules/views_ui/src/ViewEditForm.php
@@ -3,7 +3,7 @@
namespace Drupal\views_ui;
use Drupal\Component\Utility\Html;
-use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;
use Drupal\Core\Ajax\ReplaceCommand;
@@ -1098,7 +1098,7 @@ class ViewEditForm extends ViewFormBase {
$build['fields'][$id]['#class'][] = Html::cleanCssIdentifier($display['id'] . '-' . $type . '-' . $id);
if ($executable->display_handler->useGroupBy() && $handler->usesGroupBy()) {
- $build['fields'][$id]['#settings_links'][] = $this->l(SafeMarkup::format('<span class="label">@text</span>', ['@text' => $this->t('Aggregation settings')]), new Url('views_ui.form_handler_group', [
+ $build['fields'][$id]['#settings_links'][] = $this->l(new FormattableMarkup('<span class="label">@text</span>', ['@text' => $this->t('Aggregation settings')]), new Url('views_ui.form_handler_group', [
'js' => 'nojs',
'view' => $view->id(),
'display_id' => $display['id'],
@@ -1108,7 +1108,7 @@ class ViewEditForm extends ViewFormBase {
}
if ($handler->hasExtraOptions()) {
- $build['fields'][$id]['#settings_links'][] = $this->l(SafeMarkup::format('<span class="label">@text</span>', ['@text' => $this->t('Settings')]), new Url('views_ui.form_handler_extra', [
+ $build['fields'][$id]['#settings_links'][] = $this->l(new FormattableMarkup('<span class="label">@text</span>', ['@text' => $this->t('Settings')]), new Url('views_ui.form_handler_extra', [
'js' => 'nojs',
'view' => $view->id(),
'display_id' => $display['id'],
@@ -1147,7 +1147,7 @@ class ViewEditForm extends ViewFormBase {
foreach ($contents as $key => $pid) {
if ($key != $last) {
$operator = $group_info['groups'][$gid] == 'OR' ? $this->t('OR') : $this->t('AND');
- $store[$pid]['#link'] = SafeMarkup::format('@link <span>@operator</span>', ['@link' => $store[$pid]['#link'], '@operator' => $operator]);
+ $store[$pid]['#link'] = new FormattableMarkup('@link <span>@operator</span>', ['@link' => $store[$pid]['#link'], '@operator' => $operator]);
}
$build['fields'][$pid] = $store[$pid];
}
diff --git a/core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php b/core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php
index 95f6d56..33ad680 100644
--- a/core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php
+++ b/core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php
@@ -2,7 +2,7 @@
namespace Drupal\Tests\views_ui\Functional;
-use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Render\FormattableMarkup;
use Drupal\views\Views;
/**
@@ -97,8 +97,8 @@ class CustomBooleanTest extends UITestBase {
$view = Views::getView('test_view');
$output = $view->preview();
$output = \Drupal::service('renderer')->renderRoot($output);
- $this->{$values['test']}(strpos($output, $values['true']), SafeMarkup::format('Expected custom boolean TRUE value %value in output for %type', ['%value' => $values['true'], '%type' => $type]));
- $this->{$values['test']}(strpos($output, $values['false']), SafeMarkup::format('Expected custom boolean FALSE value %value in output for %type', ['%value' => $values['false'], '%type' => $type]));
+ $this->{$values['test']}(strpos($output, $values['true']), new FormattableMarkup('Expected custom boolean TRUE value %value in output for %type', ['%value' => $values['true'], '%type' => $type]));
+ $this->{$values['test']}(strpos($output, $values['false']), new FormattableMarkup('Expected custom boolean FALSE value %value in output for %type', ['%value' => $values['false'], '%type' => $type]));
}
}
@@ -169,8 +169,8 @@ class CustomBooleanTest extends UITestBase {
$view = Views::getView('test_view');
$output = $view->preview();
$output = \Drupal::service('renderer')->renderRoot($output);
- $this->{$values['test']}(strpos($output, $values['true']), SafeMarkup::format('Expected custom boolean TRUE value %value in output for %type', ['%value' => $values['true'], '%type' => $type]));
- $this->{$values['test']}(strpos($output, $values['false']), SafeMarkup::format('Expected custom boolean FALSE value %value in output for %type', ['%value' => $values['false'], '%type' => $type]));
+ $this->{$values['test']}(strpos($output, $values['true']), new FormattableMarkup('Expected custom boolean TRUE value %value in output for %type', ['%value' => $values['true'], '%type' => $type]));
+ $this->{$values['test']}(strpos($output, $values['false']), new FormattableMarkup('Expected custom boolean FALSE value %value in output for %type', ['%value' => $values['false'], '%type' => $type]));
// Assert that we are using the correct template.
$this->assertContains('llama', (string) $output);
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayTest.php b/core/modules/views_ui/tests/src/Functional/DisplayTest.php
index 9b447dd..519d522 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayTest.php
@@ -2,7 +2,7 @@
namespace Drupal\Tests\views_ui\Functional;
-use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Render\FormattableMarkup;
use Drupal\views\Entity\View;
use Drupal\views\Views;
@@ -136,7 +136,7 @@ class DisplayTest extends UITestBase {
// Assert that the expected text is found in each area category.
foreach ($areas as $type) {
$element = $this->xpath('//div[contains(@class, :class)]/div', [':class' => $type]);
- $this->assertEqual($element[0]->getHtml(), SafeMarkup::format('The selected display type does not use @type plugins', ['@type' => $type]));
+ $this->assertEqual($element[0]->getHtml(), new FormattableMarkup('The selected display type does not use @type plugins', ['@type' => $type]));
}
}
diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php
index 3182994..b4be178 100644
--- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php
+++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php
@@ -2,7 +2,7 @@
namespace Drupal\Tests\views_ui\Functional;
-use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Render\FormattableMarkup;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\views\Tests\ViewTestData;
@@ -206,7 +206,7 @@ class HandlerTest extends UITestBase {
$href = "admin/structure/views/nojs/handler/test_view_broken/default/$type/id_broken";
$result = $this->xpath('//a[contains(@href, :href)]', [':href' => $href]);
- $this->assertEqual(count($result), 1, SafeMarkup::format('Handler (%type) edit link found.', ['%type' => $type]));
+ $this->assertEqual(count($result), 1, new FormattableMarkup('Handler (%type) edit link found.', ['%type' => $type]));
$text = 'Broken/missing handler';
@@ -225,7 +225,7 @@ class HandlerTest extends UITestBase {
];
foreach ($original_configuration as $key => $value) {
- $this->assertText(SafeMarkup::format('@key: @value', ['@key' => $key, '@value' => $value]));
+ $this->assertText(new FormattableMarkup('@key: @value', ['@key' => $key, '@value' => $value]));
}
}
}
diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc
index d1aef4c..f57132f 100644
--- a/core/modules/views_ui/views_ui.theme.inc
+++ b/core/modules/views_ui/views_ui.theme.inc
@@ -5,7 +5,7 @@
* Preprocessors and theme functions for the Views UI.
*/
-use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Form\FormState;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\Checkboxes;
@@ -158,7 +158,7 @@ function template_preprocess_views_ui_build_group_filter_form(&$variables) {
'title' => t('Remove this item'),
],
]),
- '#title' => SafeMarkup::format('<span>@text</span>', ['@text' => t('Remove')]),
+ '#title' => new FormattableMarkup('<span>@text</span>', ['@text' => t('Remove')]),
];
$remove = [$form['group_items'][$group_id]['remove'], $link];
$data = [
@@ -286,7 +286,7 @@ function template_preprocess_views_ui_rearrange_filter_form(&$variables) {
$remove_link = [
'#type' => 'link',
'#url' => Url::fromRoute('<none>'),
- '#title' => SafeMarkup::format('<span>@text</span>', ['@text' => t('Remove')]),
+ '#title' => new FormattableMarkup('<span>@text</span>', ['@text' => t('Remove')]),
'#weight' => '1',
'#options' => [
'attributes' => [