Commit 9210d05c authored by catch's avatar catch

Issue #2560751 by lauriii, alexpott: Remove all usages...

Issue #2560751 by lauriii, alexpott: Remove all usages SafeMarkup::checkPlain() from Views titleQuery()
parent feb0fc2c
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\views\Plugin\views\argument\NumericArgument; use Drupal\views\Plugin\views\argument\NumericArgument;
use Drupal\Component\Utility\SafeMarkup;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
...@@ -60,7 +59,7 @@ public function titleQuery() { ...@@ -60,7 +59,7 @@ public function titleQuery() {
$feeds = $this->entityManager->getStorage('aggregator_feed')->loadMultiple($this->value); $feeds = $this->entityManager->getStorage('aggregator_feed')->loadMultiple($this->value);
foreach ($feeds as $feed) { foreach ($feeds as $feed) {
$titles[] = SafeMarkup::checkPlain($feed->label()); $titles[] = $feed->label();
} }
return $titles; return $titles;
} }
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\views\Plugin\views\argument\NumericArgument; use Drupal\views\Plugin\views\argument\NumericArgument;
use Drupal\Component\Utility\SafeMarkup;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
...@@ -60,7 +59,7 @@ public function titleQuery() { ...@@ -60,7 +59,7 @@ public function titleQuery() {
$items = $this->entityManager->getStorage('aggregator_item')->loadMultiple($this->value); $items = $this->entityManager->getStorage('aggregator_item')->loadMultiple($this->value);
foreach ($items as $feed) { foreach ($items as $feed) {
$titles[] = SafeMarkup::checkPlain($feed->label()); $titles[] = $feed->label();
} }
return $titles; return $titles;
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\Query\QueryFactory; use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\views\Plugin\views\argument\NumericArgument; use Drupal\views\Plugin\views\argument\NumericArgument;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -81,7 +80,7 @@ public function titleQuery() { ...@@ -81,7 +80,7 @@ public function titleQuery() {
$files = $controller->loadMultiple($fids); $files = $controller->loadMultiple($fids);
$titles = array(); $titles = array();
foreach ($files as $file) { foreach ($files as $file) {
$titles[] = SafeMarkup::checkPlain($file->getFilename()); $titles[] = $file->getFilename();
} }
return $titles; return $titles;
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace Drupal\node\Plugin\views\argument; namespace Drupal\node\Plugin\views\argument;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\node\NodeStorageInterface; use Drupal\node\NodeStorageInterface;
use Drupal\views\Plugin\views\argument\NumericArgument; use Drupal\views\Plugin\views\argument\NumericArgument;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -62,7 +61,7 @@ public function titleQuery() { ...@@ -62,7 +61,7 @@ public function titleQuery() {
$nodes = $this->nodeStorage->loadMultiple($this->value); $nodes = $this->nodeStorage->loadMultiple($this->value);
foreach ($nodes as $node) { foreach ($nodes as $node) {
$titles[] = SafeMarkup::checkPlain($node->label()); $titles[] = $node->label();
} }
return $titles; return $titles;
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace Drupal\node\Plugin\views\argument; namespace Drupal\node\Plugin\views\argument;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
use Drupal\views\Plugin\views\argument\NumericArgument; use Drupal\views\Plugin\views\argument\NumericArgument;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -84,7 +83,7 @@ public function titleQuery() { ...@@ -84,7 +83,7 @@ public function titleQuery() {
foreach ($results as $result) { foreach ($results as $result) {
$nodes[$result['nid']]->set('title', $result['title']); $nodes[$result['nid']]->set('title', $result['title']);
$titles[] = SafeMarkup::checkPlain($nodes[$result['nid']]->label()); $titles[] = $nodes[$result['nid']]->label();
} }
return $titles; return $titles;
......
...@@ -24,7 +24,7 @@ public function titleQuery() { ...@@ -24,7 +24,7 @@ public function titleQuery() {
$titles = array(); $titles = array();
$terms = Term::loadMultiple($this->value); $terms = Term::loadMultiple($this->value);
foreach ($terms as $term) { foreach ($terms as $term) {
$titles[] = SafeMarkup::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label()); $titles[] = \Drupal::entityManager()->getTranslationFromContext($term)->label();
} }
return $titles; return $titles;
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace Drupal\user\Plugin\views\argument; namespace Drupal\user\Plugin\views\argument;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\views\Plugin\views\argument\ManyToOne; use Drupal\views\Plugin\views\argument\ManyToOne;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -60,7 +59,7 @@ public function titleQuery() { ...@@ -60,7 +59,7 @@ public function titleQuery() {
$entities = $this->roleStorage->loadMultiple($this->value); $entities = $this->roleStorage->loadMultiple($this->value);
$titles = array(); $titles = array();
foreach ($entities as $entity) { foreach ($entities as $entity) {
$titles[] = SafeMarkup::checkPlain($entity->label()); $titles[] = $entity->label();
} }
return $titles; return $titles;
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace Drupal\user\Plugin\views\argument; namespace Drupal\user\Plugin\views\argument;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\views\Plugin\views\argument\NumericArgument; use Drupal\views\Plugin\views\argument\NumericArgument;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -61,7 +60,7 @@ public static function create(ContainerInterface $container, array $configuratio ...@@ -61,7 +60,7 @@ public static function create(ContainerInterface $container, array $configuratio
*/ */
public function titleQuery() { public function titleQuery() {
return array_map(function($account) { return array_map(function($account) {
return SafeMarkup::checkPlain($account->label()); return $account->label();
}, $this->storage->loadMultiple($this->value)); }, $this->storage->loadMultiple($this->value));
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace Drupal\Tests\user\Unit\Views\Argument; namespace Drupal\Tests\user\Unit\Views\Argument;
use Drupal\Component\Utility\Html;
use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
use Drupal\user\Entity\Role; use Drupal\user\Entity\Role;
...@@ -20,9 +19,9 @@ ...@@ -20,9 +19,9 @@
class RolesRidTest extends UnitTestCase { class RolesRidTest extends UnitTestCase {
/** /**
* Tests the title_query method. * Tests the titleQuery method.
* *
* @see \Drupal\user\Plugin\views\argument\RolesRid::title_query() * @covers ::titleQuery
*/ */
public function testTitleQuery() { public function testTitleQuery() {
$role1 = new Role(array( $role1 = new Role(array(
...@@ -81,7 +80,7 @@ public function testTitleQuery() { ...@@ -81,7 +80,7 @@ public function testTitleQuery() {
$roles_rid_argument->value = array('test_rid_1', 'test_rid_2'); $roles_rid_argument->value = array('test_rid_1', 'test_rid_2');
$titles = $roles_rid_argument->titleQuery(); $titles = $roles_rid_argument->titleQuery();
$this->assertEquals(array('test rid 1', Html::escape('test <strong>rid 2</strong>')), $titles); $this->assertEquals(array('test rid 1', 'test <strong>rid 2</strong>'), $titles);
} }
} }
...@@ -317,7 +317,7 @@ function title() { ...@@ -317,7 +317,7 @@ function title() {
* Override for specific title lookups. * Override for specific title lookups.
*/ */
public function titleQuery() { public function titleQuery() {
return array_map('\Drupal\Component\Utility\SafeMarkup::checkPlain', array_combine($this->value, $this->value)); return $this->value;
} }
public function summaryName($data) { public function summaryName($data) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment