Skip to content

Commit

Permalink
Merge pull request drupal-media#61 from cs-shadow/chase-core
Browse files Browse the repository at this point in the history
Chase Core: String::checkPlain() moved to SafeMarkup class
  • Loading branch information
slashrsm committed Mar 24, 2015
2 parents e62e0fa + 9f9b34f commit 57e2f75
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Entity/EntityBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/Permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())),
);
Expand Down
8 changes: 4 additions & 4 deletions src/Tests/EntityBrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand All @@ -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.');
}

/**
Expand All @@ -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())),
Expand Down

0 comments on commit 57e2f75

Please sign in to comment.