diff --git a/src/Entity/EntityBrowser.php b/src/Entity/EntityBrowser.php index 102f4b5..0d2f877 100644 --- a/src/Entity/EntityBrowser.php +++ b/src/Entity/EntityBrowser.php @@ -7,7 +7,7 @@ namespace Drupal\entity_browser\Entity; -use Drupal\Component\Utility\String; +use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; @@ -532,7 +532,7 @@ public function route() { 'entity_browser_id' => $this->id(), ], [ - '_permission' => 'access ' . String::checkPlain($this->id()) . ' entity browser pages', + '_permission' => 'access ' . SafeMarkup::checkPlain($this->id()) . ' entity browser pages', ], [ '_admin_route' => TRUE, diff --git a/src/Permissions.php b/src/Permissions.php index d06dffc..d09d8d3 100644 --- a/src/Permissions.php +++ b/src/Permissions.php @@ -6,7 +6,7 @@ */ namespace Drupal\entity_browser; -use Drupal\Component\Utility\String; +use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\StringTranslation\TranslationManager; @@ -63,7 +63,7 @@ public function permissions() { foreach ($browsers as $browser) { if ($browser->route()) { - $permissions['access ' . String::checkPlain($browser->id()) . ' entity browser pages'] = array( + $permissions['access ' . SafeMarkup::checkPlain($browser->id()) . ' entity browser pages'] = array( 'title' => $this->translationManager->translate('Access @name pages', array('@name' => $browser->label())), 'description' => $this->translationManager->translate('Access pages that %browser uses to operate.', array('%browser' => $browser->label())), ); diff --git a/src/Tests/EntityBrowserTest.php b/src/Tests/EntityBrowserTest.php index df66b96..a7abe26 100644 --- a/src/Tests/EntityBrowserTest.php +++ b/src/Tests/EntityBrowserTest.php @@ -8,7 +8,7 @@ namespace Drupal\entity_browser\Tests; use Drupal\Component\Plugin\Exception\PluginException; -use Drupal\Component\Utility\String; +use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Config\Entity\ConfigEntityStorage; use Drupal\Core\Entity\EntityMalformedException; use Drupal\Core\Form\FormState; @@ -231,7 +231,7 @@ protected function testDynamicRoutes() { $this->assertEqual($route->getDefault('entity_browser_id'), $entity->id(), 'Entity browser ID matches.'); $this->assertEqual($route->getDefault('_controller'), 'Drupal\entity_browser\Controllers\StandalonePage::page', 'Controller matches.'); $this->assertEqual($route->getDefault('_title_callback'), 'Drupal\entity_browser\Controllers\StandalonePage::title', 'Title callback matches.'); - $this->assertEqual($route->getRequirement('_permission'), 'access ' . String::checkPlain($entity->id()) . ' entity browser pages', 'Permission matches.'); + $this->assertEqual($route->getRequirement('_permission'), 'access ' . SafeMarkup::checkPlain($entity->id()) . ' entity browser pages', 'Permission matches.'); try { $registered_route = $this->routeProvider->getRouteByName('entity_browser.' . $entity->id()); @@ -245,7 +245,7 @@ protected function testDynamicRoutes() { $this->assertEqual($registered_route->getDefault('entity_browser_id'), $entity->id(), 'Entity browser ID matches.'); $this->assertEqual($registered_route->getDefault('_controller'), 'Drupal\entity_browser\Controllers\StandalonePage::page', 'Controller matches.'); $this->assertEqual($registered_route->getDefault('_title_callback'), 'Drupal\entity_browser\Controllers\StandalonePage::title', 'Title callback matches.'); - $this->assertEqual($registered_route->getRequirement('_permission'), 'access ' . String::checkPlain($entity->id()) . ' entity browser pages', 'Permission matches.'); + $this->assertEqual($registered_route->getRequirement('_permission'), 'access ' . SafeMarkup::checkPlain($entity->id()) . ' entity browser pages', 'Permission matches.'); } /** @@ -258,7 +258,7 @@ protected function testDynamicPermissions() { /** @var $entity \Drupal\entity_browser\EntityBrowserInterface */ $entity = $this->controller->load('test'); - $expected_permission_name = 'access ' . String::checkPlain($entity->id()) . ' entity browser pages'; + $expected_permission_name = 'access ' . SafeMarkup::checkPlain($entity->id()) . ' entity browser pages'; $expected_permission = array( 'title' => $this->container->get('string_translation')->translate('Access @name pages', array('@name' => $entity->label())), 'description' => $this->container->get('string_translation')->translate('Access pages that %browser uses to operate.', array('%browser' => $entity->label())),