Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023

This commit is contained in:
Pantheon Automation 2015-09-04 13:20:09 -07:00 committed by Greg Anderson
parent 2720a9ec4b
commit f3791f1da3
1898 changed files with 54300 additions and 11481 deletions

View file

@ -8,6 +8,7 @@
namespace Drupal\options\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\AllowedTagsXssTrait;
use Drupal\Core\Field\FieldFilteredString;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\OptGroup;
@ -48,7 +49,10 @@ class OptionsDefaultFormatter extends FormatterBase {
// If the stored value is in the current set of allowed values, display
// the associated label, otherwise just display the raw value.
$output = isset($options[$value]) ? $options[$value] : $value;
$elements[$delta] = array('#markup' => $this->fieldFilterXss($output));
$elements[$delta] = array(
'#markup' => $output,
'#allowed_tags' => FieldFilteredString::allowedTags(),
);
}
}

View file

@ -8,6 +8,7 @@
namespace Drupal\options\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\AllowedTagsXssTrait;
use Drupal\Core\Field\FieldFilteredString;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Field\FieldItemListInterface;
@ -35,7 +36,10 @@ class OptionsKeyFormatter extends FormatterBase {
$elements = array();
foreach ($items as $delta => $item) {
$elements[$delta] = array('#markup' => $this->fieldFilterXss($item->value));
$elements[$delta] = array(
'#markup' => $item->value,
'#allowed_tags' => FieldFilteredString::allowedTags(),
);
}
return $elements;

View file

@ -9,6 +9,7 @@ namespace Drupal\options\Plugin\views\argument;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Field\AllowedTagsXssTrait;
use Drupal\Core\Field\FieldFilteredString;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\FieldAPIHandlerTrait;
use Drupal\views\ViewExecutable;
@ -80,7 +81,7 @@ class NumberListField extends NumericArgument {
$value = $data->{$this->name_alias};
// If the list element has a human readable name show it.
if (isset($this->allowedValues[$value]) && !empty($this->options['summary']['human'])) {
return $this->fieldFilterXss($this->allowedValues[$value]);
return FieldFilteredString::create($this->allowedValues[$value]);
}
// Else, fallback to the key.
else {

View file

@ -8,6 +8,7 @@
namespace Drupal\options\Plugin\views\argument;
use Drupal\Core\Field\AllowedTagsXssTrait;
use Drupal\Core\Field\FieldFilteredString;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\FieldAPIHandlerTrait;
use Drupal\views\ViewExecutable;
@ -80,12 +81,9 @@ class StringListField extends StringArgument {
$value = $data->{$this->name_alias};
// If the list element has a human readable name show it.
if (isset($this->allowedValues[$value]) && !empty($this->options['summary']['human'])) {
return $this->caseTransform($this->fieldFilterXss($this->allowedValues[$value]), $this->options['case']);
}
// Else, fallback to the key.
else {
return $this->caseTransform(SafeMarkup::checkPlain($value), $this->options['case']);
$value = $this->allowedValues[$value];
}
return FieldFilteredString::create($this->caseTransform($value, $this->options['case']));
}
}

View file

@ -38,7 +38,7 @@ class OptionsFormattersTest extends OptionsFieldUnitTestBase {
$build = $items->view(array('type' => 'list_key'));
$this->assertEqual($build['#formatter'], 'list_key', 'The chosen formatter is used.');
$this->assertEqual($build[0]['#markup'], 1);
$this->assertEqual((string) $build[0]['#markup'], 1);
}
}

View file

@ -13,12 +13,12 @@ use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Tests\ViewUnitTestBase;
use Drupal\views\Tests\ViewKernelTestBase;
/**
* Base class for options views tests.
*/
abstract class OptionsTestBase extends ViewUnitTestBase {
abstract class OptionsTestBase extends ViewKernelTestBase {
/**
* Modules to enable.
@ -56,6 +56,7 @@ abstract class OptionsTestBase extends ViewUnitTestBase {
$settings = [];
$settings['type'] = 'article';
$settings['title'] = $this->randomString();
$settings['field_test_list_string'][]['value'] = $this->fieldValues[0];
$settings['field_test_list_integer'][]['value'] = 0;