Commit fa2724a4 authored by webchick's avatar webchick

Issue #2547851 by alexpott, joelpittet, dawehner, stefan.r, xjm:...

Issue #2547851 by alexpott, joelpittet, dawehner, stefan.r, xjm: SafeMarkup::format() should require arguments without them it is just SafeMarkup::set() in disguise
parent 549337a4
......@@ -344,7 +344,7 @@ function t($string, array $args = array(), array $options = array()) {
* @see t()
* @ingroup sanitization
*/
function format_string($string, array $args = array()) {
function format_string($string, array $args) {
return SafeMarkup::format($string, $args);
}
......
......@@ -218,7 +218,7 @@ public static function checkPlain($text) {
*
* @see t()
*/
public static function format($string, array $args = array()) {
public static function format($string, array $args) {
$safe = TRUE;
// Transform arguments before inserting them.
......
......@@ -7,7 +7,6 @@
namespace Drupal\Core\Entity\Plugin\DataType;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\TypedData\EntityDataDefinition;
......@@ -114,7 +113,7 @@ public function set($property_name, $value, $notify = TRUE) {
*/
public function getProperties($include_computed = FALSE) {
if (!isset($this->entity)) {
throw new MissingDataException(SafeMarkup::format('Unable to get properties as no entity has been provided.'));
throw new MissingDataException('Unable to get properties as no entity has been provided.');
}
if (!$this->entity instanceof FieldableEntityInterface) {
// @todo: Add support for config entities in
......
......@@ -121,16 +121,16 @@ function testReadWriteConfig() {
$this->assertNull($config->get('i.dont.exist'), 'Non-existent nested value returned NULL.');
// Read false value.
$this->assertEqual($config->get($false_key), '0', format_string("Boolean FALSE value returned the string '0'."));
$this->assertEqual($config->get($false_key), '0', "Boolean FALSE value returned the string '0'.");
// Read true value.
$this->assertEqual($config->get($true_key), '1', format_string("Boolean TRUE value returned the string '1'."));
$this->assertEqual($config->get($true_key), '1', "Boolean TRUE value returned the string '1'.");
// Read null value.
$this->assertIdentical($config->get('null'), NULL);
// Read false that had been nested in an array value.
$this->assertEqual($config->get($casting_array_false_value_key), '0', format_string("Nested boolean FALSE value returned the string '0'."));
$this->assertEqual($config->get($casting_array_false_value_key), '0', "Nested boolean FALSE value returned the string '0'.");
// Unset a top level value.
$config->clear($key);
......
......@@ -123,7 +123,7 @@ public function testStringFormatter() {
// Verify the cache tags.
$build = $entity->{$this->fieldName}->view();
$this->assertTrue(!isset($build[0]['#cache']), format_string('The string formatter has no cache tags.'));
$this->assertTrue(!isset($build[0]['#cache']), 'The string formatter has no cache tags.');
}
}
......@@ -123,7 +123,7 @@ public function testStringFormatter() {
// Verify the cache tags.
$build = $entity->{$this->fieldName}->view();
$this->assertTrue(!isset($build[0]['#cache']), format_string('The string formatter has no cache tags.'));
$this->assertTrue(!isset($build[0]['#cache']), 'The string formatter has no cache tags.');
$value = $this->randomMachineName();
$entity->{$this->fieldName}->value = $value;
......
......@@ -165,7 +165,7 @@ public function testLazyLoad() {
// the first AJAX command.
$this->assertIdentical($new_settings[$expected['setting_name']], $expected['setting_value'], format_string('Page now has the %setting.', array('%setting' => $expected['setting_name'])));
$expected_command = new SettingsCommand(array($expected['setting_name'] => $expected['setting_value']), TRUE);
$this->assertCommand(array_slice($commands, 0, 1), $expected_command->render(), format_string('The settings command was first.'));
$this->assertCommand(array_slice($commands, 0, 1), $expected_command->render(), 'The settings command was first.');
// Verify the expected CSS file was added, both to drupalSettings, and as
// the second AJAX command for inclusion into the HTML.
......
......@@ -554,7 +554,7 @@ protected function assertBundleOrder($order) {
}
}
}
$this->assertTrue($ok, format_string("$i is after all entities in bundle2"));
$this->assertTrue($ok, "$i is after all entities in bundle2");
}
}
......
......@@ -52,7 +52,7 @@ function testCRUD() {
// Load alias by source path.
$loadedAlias = $aliasStorage->load(array('source' => '/node/1'));
$this->assertEqual($loadedAlias['alias'], '/alias_for_node_1_und', format_string('The last created alias loaded by default.'));
$this->assertEqual($loadedAlias['alias'], '/alias_for_node_1_und', 'The last created alias loaded by default.');
//Update a few aliases
foreach ($aliases as $alias) {
......
......@@ -57,7 +57,7 @@ public function testDefaults($placeholder = NULL) {
return ['#markup' => SafeMarkup::format("Sometimes there is a placeholder: '@placeholder'.", array('@placeholder' => $placeholder))];
}
else {
return ['#markup' => SafeMarkup::format('Sometimes there is no placeholder.')];
return ['#markup' => 'Sometimes there is no placeholder.'];
}
}
......
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