diff --git a/core/includes/common.inc b/core/includes/common.inc
index 5572e54..edefe1d 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -3468,7 +3468,6 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) {
*
* @return string
* The rendered HTML of all children of the element.
-
* @see drupal_render()
*/
function drupal_render_children(&$element, $children_keys = NULL) {
@@ -3681,7 +3680,7 @@ function drupal_render_cache_generate_placeholder($callback, array &$context) {
'token' => \Drupal\Component\Utility\Crypt::randomBytesBase64(55),
);
- return '
tag is always allowed — HTML without
tags is nonsensical. - $format_tags = array('p'); + // When no text format is associated yet, assume no tag is allowed. + // @see \Drupal\Editor\EditorInterface::hasAssociatedFilterFormat() + if (!$editor->hasAssociatedFilterFormat()) { + return array(); + } - // Given the list of possible format tags, automatically determine whether - // the current text format allows this tag, and thus whether it should show - // up in the "Format" dropdown. - $possible_format_tags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre'); - foreach ($possible_format_tags as $tag) { - $input = '<' . $tag . '>TEST' . $tag . '>'; - $output = trim(check_markup($input, $editor->id(), '', TRUE)); - if ($input == $output) { - $format_tags[] = $tag; + $format = $editor->getFilterFormat(); + $cid = 'ckeditor_internal_format_tags:' . $format->id(); + + if ($cached = \Drupal::cache()->get($cid)) { + $format_tags = $cached->data; + } + else { + // The
tag is always allowed — HTML without
tags is nonsensical. + $format_tags = array('p'); + + // Given the list of possible format tags, automatically determine whether + // the current text format allows this tag, and thus whether it should show + // up in the "Format" dropdown. + $possible_format_tags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre'); + foreach ($possible_format_tags as $tag) { + $input = '<' . $tag . '>TEST' . $tag . '>'; + $output = trim(check_markup($input, $editor->id())); + if ($input == $output) { + $format_tags[] = $tag; + } } + $format_tags = implode(';', $format_tags); + + // Cache the "format_tags" configuration. This cache item is infinitely + // valid; it only changes whenever the text format is changed, hence it's + // tagged with the text format's cache tag. + \Drupal::cache()->set($cid, $format_tags, Cache::PERMANENT, $format->getCacheTag()); } - return implode(';', $format_tags); + return $format_tags; } /** diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index b09bfa8..4844daf 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1369,8 +1369,9 @@ function template_preprocess_comment(&$variables) { $variables['user_picture'] = array(); } - if (\Drupal::config('user.settings')->get('signatures') && $account->getSignature()) { - $variables['signature'] = check_markup($account->getSignature(), $account->getSignatureFormat(), '', TRUE) ; + if (isset($variables['elements']['signature'])) { + $variables['signature'] = $variables['elements']['signature']['#markup']; + unset($variables['elements']['signature']); } else { $variables['signature'] = ''; diff --git a/core/modules/comment/src/CommentViewBuilder.php b/core/modules/comment/src/CommentViewBuilder.php index e993e7a..7769b5e 100644 --- a/core/modules/comment/src/CommentViewBuilder.php +++ b/core/modules/comment/src/CommentViewBuilder.php @@ -131,6 +131,21 @@ public function buildComponents(array &$build, array $entities, array $displays, '#markup' => $placeholder, ); + $account = comment_prepare_author($entity); + if (\Drupal::config('user.settings')->get('signatures') && $account->getSignature()) { + $build[$id]['signature'] = array( + '#type' => 'processed_text', + '#text' => $account->getSignature(), + '#format' => $account->getSignatureFormat(), + '#langcode' => $entity->language()->getId(), + ); + // The signature will only be rendered in the theme layer, which means + // its associated cache tags will not bubble up. Work around this for + // now by already rendering the signature here. + // @todo remove this work-around, see https://drupal.org/node/2273277 + drupal_render($build[$id]['signature'], TRUE); + } + if (!isset($build[$id]['#attached'])) { $build[$id]['#attached'] = array(); } diff --git a/core/modules/editor/src/EditorController.php b/core/modules/editor/src/EditorController.php index 59c1ef9..e5a768e 100644 --- a/core/modules/editor/src/EditorController.php +++ b/core/modules/editor/src/EditorController.php @@ -47,7 +47,7 @@ public function getUntransformedText(EntityInterface $entity, $field_name, $lang // Direct text editing is only supported for single-valued fields. $field = $entity->getTranslation($langcode)->$field_name; - $editable_text = check_markup($field->value, $field->format, $langcode, FALSE, array(FilterInterface::TYPE_TRANSFORM_REVERSIBLE, FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE)); + $editable_text = check_markup($field->value, $field->format, $langcode, array(FilterInterface::TYPE_TRANSFORM_REVERSIBLE, FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE)); $response->addCommand(new GetUntransformedTextCommand($editable_text)); return $response; diff --git a/core/modules/editor/src/Plugin/Filter/EditorFileReference.php b/core/modules/editor/src/Plugin/Filter/EditorFileReference.php new file mode 100644 index 0000000..37717a0 --- /dev/null +++ b/core/modules/editor/src/Plugin/Filter/EditorFileReference.php @@ -0,0 +1,55 @@ +query('//*[@data-editor-file-uuid]') as $node) { + $uuid = $node->getAttribute('data-editor-file-uuid'); + // Only process the first occurrence of each file UUID. + if (!isset($processed_uuids[$uuid])) { + $processed_uuids[$uuid] = TRUE; + + $file = entity_load_by_uuid('file', $uuid); + if ($file) { + $result->addCacheTags($file->getCacheTag()); + } + } + } + } + + return $result; + } + +} diff --git a/core/modules/editor/src/Tests/EditorFileReferenceFilterTest.php b/core/modules/editor/src/Tests/EditorFileReferenceFilterTest.php new file mode 100644 index 0000000..d0bfbb5 --- /dev/null +++ b/core/modules/editor/src/Tests/EditorFileReferenceFilterTest.php @@ -0,0 +1,120 @@ + 'Editor File Reference filter', + 'description' => "Tests Editor module's file reference filter.", + 'group' => 'Text Editor', + ); + } + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $this->installConfig(array('system')); + $this->installSchema('file', array('file_managed', 'file_usage')); + + $manager = $this->container->get('plugin.manager.filter'); + $bag = new FilterBag($manager, array()); + $this->filters = $bag->getAll(); + } + + /** + * Tests the editor file reference filter. + */ + function testEditorFileReferenceFilter() { + $filter = $this->filters['editor_file_reference']; + + $test = function($input) use ($filter) { + return $filter->process($input, 'und'); + }; + + file_put_contents('public://llama.jpg', $this->randomName()); + $image = entity_create('file', array('uri' => 'public://llama.jpg')); + $image->save(); + $id = $image->id(); + $uuid = $image->uuid(); + + file_put_contents('public://alpaca.jpg', $this->randomName()); + $image_2 = entity_create('file', array('uri' => 'public://alpaca.jpg')); + $image_2->save(); + $id_2 = $image_2->id(); + $uuid_2 = $image_2->uuid(); + + $this->pass('No data-editor-file-uuid attribute.'); + $input = ''; + $output = $test($input); + $this->assertIdentical($input, $output->getProcessedText()); + + $this->pass('One data-editor-file-uuid attribute.'); + $input = ''; + $output = $test($input); + $this->assertIdentical($input, $output->getProcessedText()); + $this->assertEqual(array('file' => array($id)), $output->getCacheTags()); + + $this->pass('One data-editor-file-uuid attribute with odd capitalization.'); + $input = ''; + $output = $test($input); + $this->assertIdentical($input, $output->getProcessedText()); + $this->assertEqual(array('file' => array($id)), $output->getCacheTags()); + + $this->pass('One data-editor-file-uuid attribute on a non-image tag.'); + $input = ''; + $output = $test($input); + $this->assertIdentical($input, $output->getProcessedText()); + $this->assertEqual(array('file' => array($id)), $output->getCacheTags()); + + $this->pass('One data-editor-file-uuid attribute with an invalid value.'); + $input = ''; + $output = $test($input); + $this->assertIdentical($input, $output->getProcessedText()); + $this->assertEqual(array(), $output->getCacheTags()); + + $this->pass('Two different data-editor-file-uuid attributes.'); + $input = ''; + $input .= ''; + $output = $test($input); + $this->assertIdentical($input, $output->getProcessedText()); + $this->assertEqual(array('file' => array($id, $id_2)), $output->getCacheTags()); + + $this->pass('Two identical data-editor-file-uuid attributes.'); + $input = ''; + $input .= ''; + $output = $test($input); + $this->assertIdentical($input, $output->getProcessedText()); + $this->assertEqual(array('file' => array($id)), $output->getCacheTags()); + } + +} diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php index 410a256..4065ea2 100644 --- a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php +++ b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php @@ -106,6 +106,7 @@ public function viewElements(FieldItemListInterface $items) { // its cache tags to be bubbled up and included with those of the // main entity when cache tags are collected for a renderable array // in drupal_render(). + // @todo remove this work-around, see https://drupal.org/node/2273277 $referenced_entity_build = entity_view($item->entity, $view_mode, $item->getLangcode()); drupal_render($referenced_entity_build, TRUE); $elements[$delta] = $referenced_entity_build; diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceFormatterTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceFormatterTest.php index 37fd4b1..61d0ee5 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceFormatterTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceFormatterTest.php @@ -60,8 +60,6 @@ public static function getInfo() { public function setUp() { parent::setUp(); - $this->installConfig(array('filter')); - entity_reference_create_instance($this->entityType, $this->bundle, $this->fieldName, 'Field test', $this->entityType); // Set up a field, so that the entity that'll be referenced bubbles up a @@ -88,6 +86,11 @@ public function setUp() { )) ->save(); + entity_create('filter_format', array( + 'format' => 'full_html', + 'name' => 'Full HTML', + ))->save(); + // Create the entity to be referenced. $this->referencedEntity = entity_create($this->entityType, array('name' => $this->randomName())); $this->referencedEntity->body = array( @@ -180,7 +183,7 @@ public function testEntityFormatter() { $expected_rendered_body_field = '
Hello, world!
Hello, world!
', + '#format' => 'element_test', + ); + drupal_render($build); + + // Verify the assets, cache tags and #post_render_cache callbacks. + $expected_assets = array( + // The assets attached by the filter_test_assets filter. + 'library' => array( + 'filter/caption', + ), + ); + $this->assertEqual($expected_assets, $build['#attached'], 'Expected assets present'); + $expected_cache_tags = array( + // The cache tag set by the processed_text element itself. + 'filter_format' => array( + 'element_test' => 'element_test', + ), + // The cache tags set by the filter_test_cache_tags filter. + 'foo' => array( + 'bar' => 'bar', + 'baz' => 'baz', + ), + ); + $this->assertEqual($expected_cache_tags, $build['#cache']['tags'], 'Expected cache tags present.'); + $expected_markup = 'Hello, world!
This is a dynamic llama.
'; + $this->assertEqual($expected_markup, $build['#markup'], 'Expected #post_render_cache callback has been applied.'); + } + + /** * Tests the function of the typed data type. */ function testTypedDataAPI() { diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php index 7aa30a8..9e6d74b 100644 --- a/core/modules/filter/src/Tests/FilterAdminTest.php +++ b/core/modules/filter/src/Tests/FilterAdminTest.php @@ -8,7 +8,6 @@ namespace Drupal\filter\Tests; use Drupal\simpletest\WebTestBase; -use Drupal\filter\Plugin\FilterInterface; /** * Tests the administrative functionality of the Filter module. @@ -354,73 +353,4 @@ function testUrlFilterAdmin() { $this->assertNoRaw(t('The text format %format has been updated.', array('%format' => 'Basic HTML'))); } - /** - * Tests that changing filter properties clears the filter cache. - */ - public function testFilterAdminClearsFilterCache() { - $restricted = 'restricted_html'; - $original_markup = '';
- $this->drupalPostForm('admin/config/content/formats/manage/' . $restricted, $edit, t('Save configuration'));
- $this->assertUrl('admin/config/content/formats');
- $this->drupalGet('admin/config/content/formats/manage/' . $restricted);
- $this->assertFieldByName('filters[filter_html][settings][allowed_html]', $edit['filters[filter_html][settings][allowed_html]'], 'Allowed HTML tag added.');
-
- // Check that the filter cache is empty after the format was changed.
- $this->assertFalse(\Drupal::cache('filter')->get($cid));
-
- // Check that after changind the filter, the changes are reflected in the
- // filtered markup.
- $actual_markup = check_markup($original_markup, $restricted, '', TRUE);
- $this->assertIdentical(strpos($actual_markup, ''), FALSE, 'The h4 tag is not present in the resulting markup');
- }
-
-
- /**
- * Computes the cache-key for the given text just like check_markup().
- *
- * Note that this is copied over from check_markup().
- *
- * @return string|NULL
- * The cache-key used to store the text in the filter cache.
- */
- protected function computeFilterCacheId($text, $format_id = NULL, $langcode = '', $cache = FALSE, $filter_types_to_skip = array()) {
- if (!isset($format_id)) {
- $format_id = filter_fallback_format();
- }
- // If the requested text format does not exist, the text cannot be filtered.
- if (!$format = entity_load('filter_format', $format_id)) {
- return;
- }
-
- // Prevent FilterInterface::TYPE_HTML_RESTRICTOR from being skipped.
- if (in_array(FilterInterface::TYPE_HTML_RESTRICTOR, $filter_types_to_skip)) {
- $filter_types_to_skip = array_diff($filter_types_to_skip, array(FilterInterface::TYPE_HTML_RESTRICTOR));
- }
-
- // When certain filters should be skipped, don't perform caching.
- if ($filter_types_to_skip) {
- $cache = FALSE;
- }
-
- // Compute the cache key if the text is cacheable.
- $cache = $cache && !empty($format->cache);
- $cache_id = '';
- if ($cache) {
- return $format->format . ':' . $langcode . ':' . hash('sha256', $text);
- }
- }
-
}
diff --git a/core/modules/filter/src/Tests/FilterCrudTest.php b/core/modules/filter/src/Tests/FilterCrudTest.php
index 041f309..b592c5f 100644
--- a/core/modules/filter/src/Tests/FilterCrudTest.php
+++ b/core/modules/filter/src/Tests/FilterCrudTest.php
@@ -65,8 +65,8 @@ function testTextFormatCrud() {
$format->save();
$this->verifyTextFormat($format);
- // Add a uncacheable filter and save again.
- $format->setFilterConfig('filter_test_uncacheable', array(
+ // Add a filter_test_replace filter and save again.
+ $format->setFilterConfig('filter_test_replace', array(
'status' => 1,
));
$format->save();
@@ -90,22 +90,9 @@ function verifyTextFormat($format) {
$filter_format = entity_load('filter_format', $format->format);
$this->assertEqual($filter_format->format, $format->format, format_string('filter_format_load: Proper format id for text format %format.', $t_args));
$this->assertEqual($filter_format->name, $format->name, format_string('filter_format_load: Proper title for text format %format.', $t_args));
- $this->assertEqual($filter_format->cache, $format->cache, format_string('filter_format_load: Proper cache indicator for text format %format.', $t_args));
$this->assertEqual($filter_format->weight, $format->weight, format_string('filter_format_load: Proper weight for text format %format.', $t_args));
// Check that the filter was created in site default language.
$this->assertEqual($format->langcode, $default_langcode, format_string('filter_format_load: Proper language code for text format %format.', $t_args));
-
- // Verify the 'cache' text format property according to enabled filters.
- $cacheable = TRUE;
- foreach ($format->filters() as $name => $filter) {
- // If this filter is not cacheable, update $cacheable accordingly, so we
- // can verify $format->cache after iterating over all filters.
- if ($filter->status && !$filter->cache) {
- $cacheable = FALSE;
- break;
- }
- }
- $this->assertEqual($filter_format->cache, $cacheable, 'Text format contains proper cache property.');
}
}
diff --git a/core/modules/filter/src/Tests/FilterDefaultConfigTest.php b/core/modules/filter/src/Tests/FilterDefaultConfigTest.php
index 9d8f3ca..b166e41 100644
--- a/core/modules/filter/src/Tests/FilterDefaultConfigTest.php
+++ b/core/modules/filter/src/Tests/FilterDefaultConfigTest.php
@@ -49,7 +49,6 @@ function testInstallation() {
// Verify that format default property values have been added/injected.
$this->assertTrue($format->uuid());
- $this->assertEqual($format->get('cache'), 1);
// Verify that the loaded format does not contain any roles.
$this->assertEqual($format->get('roles'), NULL);
diff --git a/core/modules/filter/src/Tests/FilterSecurityTest.php b/core/modules/filter/src/Tests/FilterSecurityTest.php
index 6321c1b..6aea5de 100644
--- a/core/modules/filter/src/Tests/FilterSecurityTest.php
+++ b/core/modules/filter/src/Tests/FilterSecurityTest.php
@@ -103,7 +103,7 @@ function testDisableFilterModule() {
function testSkipSecurityFilters() {
$text = "Text with some disallowed tags: , , .";
$expected_filtered_text = "Text with some disallowed tags: , unicorn, .";
- $this->assertEqual(check_markup($text, 'filtered_html', '', FALSE, array()), $expected_filtered_text, 'Expected filter result.');
- $this->assertEqual(check_markup($text, 'filtered_html', '', FALSE, array(FilterInterface::TYPE_HTML_RESTRICTOR)), $expected_filtered_text, 'Expected filter result, even when trying to disable filters of the FilterInterface::TYPE_HTML_RESTRICTOR type.');
+ $this->assertEqual(check_markup($text, 'filtered_html', '', array()), $expected_filtered_text, 'Expected filter result.');
+ $this->assertEqual(check_markup($text, 'filtered_html', '', array(FilterInterface::TYPE_HTML_RESTRICTOR)), $expected_filtered_text, 'Expected filter result, even when trying to disable filters of the FilterInterface::TYPE_HTML_RESTRICTOR type.');
}
}
diff --git a/core/modules/filter/src/Tests/FilterUnitTest.php b/core/modules/filter/src/Tests/FilterUnitTest.php
index a51d6b9..6426bf6 100644
--- a/core/modules/filter/src/Tests/FilterUnitTest.php
+++ b/core/modules/filter/src/Tests/FilterUnitTest.php
@@ -52,107 +52,141 @@ function testCaptionFilter() {
$filter = $this->filters['filter_caption'];
$test = function($input) use ($filter) {
- return $filter->process($input, 'und', FALSE, '');
+ return $filter->process($input, 'und');
};
+ $attached_library = array(
+ 'library' => array(
+ 'filter/caption',
+ ),
+ );
+
// No data-caption nor data-align attributes.
$input = '';
$expected = $input;
- $this->assertIdentical($expected, $test($input));
+ $this->assertIdentical($expected, $test($input)->getProcessedText());
// Only data-caption attribute.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
// Empty data-caption attribute.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $this->assertIdentical($expected, $test($input)->getProcessedText());
// HTML entities in the caption.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
// HTML encoded as HTML entities in data-caption attribute.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
// HTML (not encoded as HTML entities) in data-caption attribute, which is
// not allowed by the HTML spec, but may happen when people manually write
// HTML, so we explicitly support it.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
// Security test: attempt an XSS.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
// Only data-align attribute: all 3 allowed values.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $this->assertIdentical($expected, $test($input)->getProcessedText());
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $this->assertIdentical($expected, $test($input)->getProcessedText());
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $this->assertIdentical($expected, $test($input)->getProcessedText());
// Only data-align attribute: a disallowed value.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $this->assertIdentical($expected, $test($input)->getProcessedText());
// Empty data-align attribute.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $this->assertIdentical($expected, $test($input)->getProcessedText());
// Both data-caption and data-align attributes: all 3 allowed values for the
// data-align attribute.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
// Both data-caption and data-align attributes, but a disallowed data-align
// attribute value.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
// Ensure the filter also works with uncommon yet valid attribute quoting.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
// Security test: attempt to inject an additional class.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
// Security test: attempt an XSS.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
// Finally, ensure that this also works on any other tag.
$input = '';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
$input = 'baz ';
$expected = '';
- $this->assertIdentical($expected, $test($input));
+ $output = $test($input);
+ $this->assertIdentical($expected, $output->getProcessedText());
+ $this->assertIdentical($attached_library, $output->getAssets());
}
/**
@@ -676,7 +710,7 @@ function testUrlFilter() {
*/
function assertFilteredString($filter, $tests) {
foreach ($tests as $source => $tasks) {
- $result = $filter->process($source, $filter, FALSE, '');
+ $result = $filter->process($source, $filter)->getProcessedText();
foreach ($tasks as $value => $is_expected) {
// Not using assertIdentical, since combination with strpos() is hard to grok.
if ($is_expected) {
diff --git a/core/modules/filter/tests/filter_test/config/install/filter.format.filter_test.yml b/core/modules/filter/tests/filter_test/config/install/filter.format.filter_test.yml
index 9b48b54..d3d77fc 100644
--- a/core/modules/filter/tests/filter_test/config/install/filter.format.filter_test.yml
+++ b/core/modules/filter/tests/filter_test/config/install/filter.format.filter_test.yml
@@ -4,7 +4,6 @@ weight: 2
roles:
- anonymous
- authenticated
-cache: true
status: true
langcode: en
filters:
diff --git a/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestAssets.php b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestAssets.php
new file mode 100644
index 0000000..a7de6d9
--- /dev/null
+++ b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestAssets.php
@@ -0,0 +1,38 @@
+addAssets(array(
+ 'library' => array(
+ 'filter/caption',
+ ),
+ ));
+ return $result;
+ }
+
+}
diff --git a/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestCacheTags.php b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestCacheTags.php
new file mode 100644
index 0000000..3c03c3f
--- /dev/null
+++ b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestCacheTags.php
@@ -0,0 +1,35 @@
+addCacheTags(array('foo' => array('bar')));
+ $result->addCacheTags(array('foo' => array('baz')));
+ return $result;
+ }
+
+}
diff --git a/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestPostRenderCache.php b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestPostRenderCache.php
new file mode 100644
index 0000000..c8beaef
--- /dev/null
+++ b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestPostRenderCache.php
@@ -0,0 +1,59 @@
+ 'llama',
+ 'token' => drupal_render_cache_generate_token(),
+ );
+ $result = new FilterProcessResult($text . '' . drupal_render_cache_generate_placeholder($callback, $context, $context['token']) . '
');
+ $result->addPostRenderCacheCallback($callback, $context);
+ return $result;
+ }
+
+ /**
+ * #post_render_cache callback; replaces placeholder with a dynamic thing.
+ *
+ * @param array $element
+ * The renderable array that contains the to be replaced placeholder.
+ * @param array $context
+ * An array with the following keys:
+ * - thing: a "thing" string
+ *
+ * @return array
+ * A renderable array containing the comment form.
+ */
+ public static function renderDynamicThing(array $element, array $context) {
+ $callback = '\Drupal\filter_test\Plugin\Filter\FilterTestPostRenderCache::renderDynamicThing';
+ $placeholder = drupal_render_cache_generate_placeholder($callback, $context, $context['token']);
+ $markup = format_string('This is a dynamic @thing.', array('@thing' => $context['thing']));
+ $element['#markup'] = str_replace($placeholder, $markup, $element['#markup']);
+ return $element;
+ }
+
+}
diff --git a/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestReplace.php b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestReplace.php
index f48c5b1..735c02d 100644
--- a/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestReplace.php
+++ b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestReplace.php
@@ -7,6 +7,7 @@
namespace Drupal\filter_test\Plugin\Filter;
+use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;
/**
@@ -24,15 +25,11 @@ class FilterTestReplace extends FilterBase {
/**
* {@inheritdoc}
*/
- public function process($text, $langcode, $cache, $cache_id) {
+ public function process($text, $langcode) {
$text = array();
$text[] = 'Filter: ' . $this->getLabel() . ' (' . $this->getPluginId() . ')';
$text[] = 'Language: ' . $langcode;
- $text[] = 'Cache: ' . ($cache ? 'Enabled' : 'Disabled');
- if ($cache_id) {
- $text[] = 'Cache ID: ' . $cache_id;
- }
- return implode("
\n", $text);
+ return new FilterProcessResult(implode("
\n", $text));
}
}
diff --git a/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestRestrictTagsAndAttributes.php b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestRestrictTagsAndAttributes.php
index 6e95d2e..c11160d 100644
--- a/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestRestrictTagsAndAttributes.php
+++ b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestRestrictTagsAndAttributes.php
@@ -7,6 +7,7 @@
namespace Drupal\filter_test\Plugin\Filter;
+use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;
use Drupal\Component\Utility\Xss;
@@ -25,11 +26,11 @@ class FilterTestRestrictTagsAndAttributes extends FilterBase {
/**
* {@inheritdoc}
*/
- public function process($text, $langcode, $cache, $cache_id) {
+ public function process($text, $langcode) {
$allowed_tags = array_filter($this->settings['restrictions']['allowed'], function($value) {
return is_array($value) || (bool) $value !== FALSE;
});
- return Xss::filter($text, array_keys($allowed_tags));
+ return new FilterProcessResult(Xss::filter($text, array_keys($allowed_tags)));
}
/**
diff --git a/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestUncacheable.php b/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestUncacheable.php
deleted file mode 100644
index fd8318f..0000000
--- a/core/modules/filter/tests/filter_test/src/Plugin/Filter/FilterTestUncacheable.php
+++ /dev/null
@@ -1,32 +0,0 @@
-assertIdentical($placeholder, Html::normalize($placeholder), 'Placeholder unaltered by Html::normalize() which is used by FilterHtmlCorrector.');
+
$test_element = array(
'#post_render_cache' => array(
$callback => array(
@@ -825,7 +827,7 @@ function testDrupalRenderRenderCachePlaceholder() {
$this->assertIdentical($token, $expected_token, 'The tokens are identical');
// Verify the token is in the cached element.
$expected_element = array(
- '#markup' => ' ',
+ '#markup' => ' ',
'#post_render_cache' => array(
'common_test_post_render_cache_placeholder' => array(
$context
@@ -923,7 +925,7 @@ function testDrupalRenderChildElementRenderCachePlaceholder() {
$this->assertIdentical($token, $expected_token, 'The tokens are identical for the child element');
// Verify the token is in the cached element.
$expected_element = array(
- '#markup' => ' ',
+ '#markup' => ' ',
'#post_render_cache' => array(
'common_test_post_render_cache_placeholder' => array(
$context,
@@ -948,7 +950,7 @@ function testDrupalRenderChildElementRenderCachePlaceholder() {
$this->assertIdentical($token, $expected_token, 'The tokens are identical for the parent element');
// Verify the token is in the cached element.
$expected_element = array(
- '#markup' => ' ' . "\n",
+ '#markup' => ' ' . "\n",
'#post_render_cache' => array(
'common_test_post_render_cache_placeholder' => array(
$context,
@@ -977,7 +979,7 @@ function testDrupalRenderChildElementRenderCachePlaceholder() {
$this->assertIdentical($token, $expected_token, 'The tokens are identical for the child element');
// Verify the token is in the cached element.
$expected_element = array(
- '#markup' => ' ',
+ '#markup' => ' ',
'#post_render_cache' => array(
'common_test_post_render_cache_placeholder' => array(
$context,
diff --git a/core/modules/text/src/Plugin/Field/FieldFormatter/TextDefaultFormatter.php b/core/modules/text/src/Plugin/Field/FieldFormatter/TextDefaultFormatter.php
index 5e0f80b..cfd83dc 100644
--- a/core/modules/text/src/Plugin/Field/FieldFormatter/TextDefaultFormatter.php
+++ b/core/modules/text/src/Plugin/Field/FieldFormatter/TextDefaultFormatter.php
@@ -32,18 +32,67 @@ class TextDefaultFormatter extends FormatterBase {
* {@inheritdoc}
*/
public function viewElements(FieldItemListInterface $items) {
+ if ($this->getFieldSetting('text_processing')) {
+ return $this->viewElementsWithTextProcessing($items);
+ }
+ else {
+ return $this->viewElementsWithoutTextProcessing($items);
+ }
+ }
+
+ /**
+ * Builds a renderable array when text processing is enabled.
+ *
+ * @param \Drupal\Core\Field\FieldItemListInterface $items
+ * The text field values to be rendered.
+ *
+ * @return array
+ * A renderable array for $items, as an array of child elements keyed by
+ * consecutive numeric indexes starting from 0.
+ */
+ protected function viewElementsWithTextProcessing(FieldItemListInterface $items) {
+ $elements = array();
+
+ foreach ($items as $delta => $item) {
+ $elements[$delta] = array(
+ '#type' => 'processed_text',
+ '#text' => $item->value,
+ '#format' => $item->format,
+ '#langcode' => $item->getLangcode(),
+ );
+ // The viewElements() method of entity field formatters is run
+ // during the #pre_render phase of rendering an entity. A formatter
+ // builds the content of the field in preparation for theming.
+ // All cache tags must be available after the #pre_render phase. In order
+ // to collect the cache tags associated with the processed text, it must
+ // be passed to drupal_render() so that its #pre_render callback is
+ // invoked and its full build array is assembled. Rendering the processed
+ // text in place here will allow its cache tags to be bubbled up and
+ // included with those of the main entity when cache tags are collected
+ // for a renderable array in drupal_render().
+ // @todo remove this work-around, see https://drupal.org/node/2273277
+ drupal_render($elements[$delta], TRUE);
+ }
+
+ return $elements;
+ }
+
+ /**
+ * Builds a renderable array when text processing is disabled.
+ *
+ * @param \Drupal\Core\Field\FieldItemListInterface $items
+ * The text field values to be rendered.
+ *
+ * @return array
+ * A renderable array for $items, as an array of child elements keyed by
+ * consecutive numeric indexes starting from 0.
+ */
+ protected function viewElementsWithoutTextProcessing(FieldItemListInterface $items) {
$elements = array();
foreach ($items as $delta => $item) {
$elements[$delta] = array(
- '#markup' => $item->processed,
- '#cache' => array(
- 'tags' => array(
- 'filter_format' => array(
- $item->format,
- ),
- ),
- ),
+ '#markup' => $item->processed,
);
}
diff --git a/core/modules/text/src/Plugin/Field/FieldFormatter/TextTrimmedFormatter.php b/core/modules/text/src/Plugin/Field/FieldFormatter/TextTrimmedFormatter.php
index d4b3c34..f2bbefc 100644
--- a/core/modules/text/src/Plugin/Field/FieldFormatter/TextTrimmedFormatter.php
+++ b/core/modules/text/src/Plugin/Field/FieldFormatter/TextTrimmedFormatter.php
@@ -68,26 +68,84 @@ public function settingsSummary() {
* {@inheritdoc}
*/
public function viewElements(FieldItemListInterface $items) {
+ if ($this->getFieldSetting('text_processing')) {
+ return $this->viewElementsWithTextProcessing($items);
+ }
+ else {
+ return $this->viewElementsWithoutTextProcessing($items);
+ }
+ }
+
+ /**
+ * Builds a renderable array when text processing is enabled.
+ *
+ * @param \Drupal\Core\Field\FieldItemListInterface $items
+ * The text field values to be rendered.
+ *
+ * @return array
+ * A renderable array for $items, as an array of child elements keyed by
+ * consecutive numeric indexes starting from 0.
+ */
+ protected function viewElementsWithTextProcessing(FieldItemListInterface $items) {
+ $elements = array();
+
+ foreach ($items as $delta => $item) {
+ $elements[$delta] = array(
+ '#type' => 'processed_text',
+ '#text' => NULL,
+ '#format' => $item->format,
+ '#langcode' => $item->getLangcode(),
+ );
+
+ // The viewElements() method of entity field formatters is run
+ // during the #pre_render phase of rendering an entity. A formatter
+ // builds the content of the field in preparation for theming.
+ // All cache tags must be available after the #pre_render phase. In order
+ // to collect the cache tags associated with the processed text, it must
+ // be passed to drupal_render() so that its #pre_render callback is
+ // invoked and its full build array is assembled. Rendering the processed
+ // text in place here will allow its cache tags to be bubbled up and
+ // included with those of the main entity when cache tags are collected
+ // for a renderable array in drupal_render().
+ if ($this->getPluginId() == 'text_summary_or_trimmed' && !empty($item->summary)) {
+ $elements[$delta]['#text'] = $item->summary;
+ // @todo remove this work-around, see https://drupal.org/node/2273277
+ drupal_render($elements[$delta], TRUE);
+ }
+ else {
+ $elements[$delta]['#text'] = $item->value;
+ // @todo remove this work-around, see https://drupal.org/node/2273277
+ drupal_render($elements[$delta], TRUE);
+ $elements[$delta]['#markup'] = text_summary($elements[$delta]['#markup'], $item->format, $this->getSetting('trim_length'));
+ }
+ }
+
+ return $elements;
+ }
+
+ /**
+ * Builds a renderable array when text processing is disabled.
+ *
+ * @param \Drupal\Core\Field\FieldItemListInterface $items
+ * The text field values to be rendered.
+ *
+ * @return array
+ * A renderable array for $items, as an array of child elements keyed by
+ * consecutive numeric indexes starting from 0.
+ */
+ protected function viewElementsWithoutTextProcessing(FieldItemListInterface $items) {
$elements = array();
- $text_processing = $this->getFieldSetting('text_processing');
foreach ($items as $delta => $item) {
if ($this->getPluginId() == 'text_summary_or_trimmed' && !empty($item->summary)) {
$output = $item->summary_processed;
}
else {
- $output = $item->processed;
- $output = text_summary($output, $text_processing ? $item->format : NULL, $this->getSetting('trim_length'));
+ $output = text_summary($item->processed, NULL, $this->getSetting('trim_length'));
}
+
$elements[$delta] = array(
'#markup' => $output,
- '#cache' => array(
- 'tags' => array(
- 'filter_format' => array(
- $item->format,
- ),
- ),
- ),
);
}
diff --git a/core/modules/text/src/Tests/Formatter/TextFormatterTest.php b/core/modules/text/src/Tests/Formatter/TextFormatterTest.php
new file mode 100644
index 0000000..3745a5a
--- /dev/null
+++ b/core/modules/text/src/Tests/Formatter/TextFormatterTest.php
@@ -0,0 +1,137 @@
+ 'Text formatters',
+ 'description' => 'Tests the text formatters functionality.',
+ 'group' => 'Text ',
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUp() {
+ parent::setUp();
+
+ entity_create('filter_format', array(
+ 'format' => 'my_text_format',
+ 'name' => 'My text format',
+ 'filters' => array(
+ 'filter_autop' => array(
+ 'module' => 'filter',
+ 'status' => TRUE,
+ ),
+ ),
+ ))->save();
+
+ // Set up two fields: one with text processing enabled, the other disabled.
+ entity_create('field_config', array(
+ 'name' => 'processed_text',
+ 'entity_type' => $this->entityType,
+ 'type' => 'text',
+ 'settings' => array(),
+ ))->save();
+ entity_create('field_instance_config', array(
+ 'entity_type' => $this->entityType,
+ 'bundle' => $this->bundle,
+ 'field_name' => 'processed_text',
+ 'label' => 'Processed text',
+ 'settings' => array(
+ 'text_processing' => TRUE,
+ ),
+ ))->save();
+ entity_create('field_config', array(
+ 'name' => 'unprocessed_text',
+ 'entity_type' => $this->entityType,
+ 'type' => 'text',
+ 'settings' => array(),
+ ))->save();
+ entity_create('field_instance_config', array(
+ 'entity_type' => $this->entityType,
+ 'bundle' => $this->bundle,
+ 'field_name' => 'unprocessed_text',
+ 'label' => 'Unprocessed text',
+ 'settings' => array(
+ 'text_processing' => FALSE,
+ ),
+ ))->save();
+ }
+
+ /**
+ * Tests all text field formatters.
+ */
+ public function testFormatters() {
+ $formatters = array(
+ 'text_default',
+ 'text_trimmed',
+ 'text_summary_or_trimmed',
+ );
+
+ // Create the entity to be referenced.
+ $entity = entity_create($this->entityType, array('name' => $this->randomName()));
+ $entity->processed_text = array(
+ 'value' => 'Hello, world!',
+ 'format' => 'my_text_format',
+ );
+ $entity->unprocessed_text = array(
+ 'value' => 'Hello, world!',
+ );
+ $entity->save();
+
+ foreach ($formatters as $formatter) {
+ // Verify the processed text field formatter's render array.
+ $build = $entity->get('processed_text')->view(array('type' => $formatter));
+ $this->assertEqual($build[0]['#markup'], "Hello, world!
\n");
+ $expected_cache_tags = array(
+ 'filter_format' => array('my_text_format' => 'my_text_format'),
+ );
+ $this->assertEqual($build[0]['#cache']['tags'], $expected_cache_tags, format_string('The @formatter formatter has the expected cache tags when formatting a processed text field.', array('@formatter' => $formatter)));
+
+ // Verify the unprocessed text field formatter's render array.
+ $build = $entity->get('unprocessed_text')->view(array('type' => $formatter));
+ debug($build[0]);
+ $this->assertEqual($build[0]['#markup'], 'Hello, world!');
+ $this->assertTrue(!isset($build[0]['#cache']), format_string('The @formatter formatter has the expected cache tags when formatting an unprocessed text field.', array('@formatter' => $formatter)));
+ }
+ }
+
+}
diff --git a/core/modules/text/src/TextProcessed.php b/core/modules/text/src/TextProcessed.php
index 5d99de3..3666d29 100644
--- a/core/modules/text/src/TextProcessed.php
+++ b/core/modules/text/src/TextProcessed.php
@@ -34,7 +34,7 @@ public function __construct(DataDefinitionInterface $definition, $name = NULL, T
parent::__construct($definition, $name, $parent);
if ($definition->getSetting('text source') === NULL) {
- throw new \InvalidArgumentException("The definition's 'source' key has to specify the name of the text property to be processed.");
+ throw new \InvalidArgumentException("The definition's 'text source' key has to specify the name of the text property to be processed.");
}
}
diff --git a/core/modules/user/src/Tests/UserSignatureTest.php b/core/modules/user/src/Tests/UserSignatureTest.php
index 83f5973..ce6c5ff 100644
--- a/core/modules/user/src/Tests/UserSignatureTest.php
+++ b/core/modules/user/src/Tests/UserSignatureTest.php
@@ -68,7 +68,7 @@ function setUp() {
// Create regular and administrative users.
$this->web_user = $this->drupalCreateUser(array('post comments'));
- $admin_permissions = array('administer comments');
+ $admin_permissions = array('post comments', 'administer comments');
foreach (filter_formats() as $format) {
if ($permission = $format->getPermissionName()) {
$admin_permissions[] = $permission;
@@ -82,7 +82,14 @@ function setUp() {
* upon display.
*/
function testUserSignature() {
- $node = $this->drupalCreateNode();
+ $node = $this->drupalCreateNode(array(
+ 'body' => array(
+ 0 => array(
+ 'value' => $this->randomName(32),
+ 'format' => 'full_html',
+ ),
+ ),
+ ));
// Verify that user signature field is not displayed on registration form.
$this->drupalGet('user/register');
@@ -99,6 +106,10 @@ function testUserSignature() {
// Verify that values were stored.
$this->assertFieldByName('signature[value]', $edit['signature[value]'], 'Submitted signature text found.');
+ // Verify that the user signature's text format's cache tag is absent.
+ $this->drupalGet('node/' . $node->id());
+ $this->assertTrue(!in_array('filter_format:filtered_html_format', explode(' ', $this->drupalGetHeader('X-Drupal-Cache-Tags'))));
+
// Create a comment.
$edit = array();
$edit['subject'] = $this->randomName(8);
@@ -121,5 +132,8 @@ function testUserSignature() {
$this->drupalGet('node/' . $node->id());
$this->assertNoRaw($signature_text, 'Unfiltered signature text not found.');
$this->assertRaw(check_markup($signature_text, $this->filtered_html_format->format), 'Filtered signature text found.');
+ // Verify that the user signature's text format's cache tag is present.
+ $this->drupalGet('node/' . $node->id());
+ $this->assertTrue(in_array('filter_format:filtered_html_format', explode(' ', $this->drupalGetHeader('X-Drupal-Cache-Tags'))));
}
}
diff --git a/core/modules/views/src/Plugin/views/area/Text.php b/core/modules/views/src/Plugin/views/area/Text.php
index 86288b0..de89210 100644
--- a/core/modules/views/src/Plugin/views/area/Text.php
+++ b/core/modules/views/src/Plugin/views/area/Text.php
@@ -58,20 +58,13 @@ public function render($empty = FALSE) {
$format = isset($this->options['format']) ? $this->options['format'] : filter_default_format();
if (!$empty || !empty($this->options['empty'])) {
return array(
- '#markup' => $this->renderTextarea($this->options['content'], $format),
+ '#type' => 'processed_text',
+ '#text' => $this->tokenizeValue($this->options['content']),
+ '#format' => $format,
);
}
return array();
}
- /**
- * Render a text area, using the proper format.
- */
- public function renderTextarea($value, $format) {
- if ($value) {
- return check_markup($this->tokenizeValue($value), $format, '', FALSE);
- }
- }
-
}
diff --git a/core/modules/views/src/Plugin/views/field/Markup.php b/core/modules/views/src/Plugin/views/field/Markup.php
index ff43934..465f655 100644
--- a/core/modules/views/src/Plugin/views/field/Markup.php
+++ b/core/modules/views/src/Plugin/views/field/Markup.php
@@ -53,7 +53,7 @@ public function render(ResultRow $values) {
}
if ($value) {
$value = str_replace('', '', $value);
- return check_markup($value, $format, '');
+ return check_markup($value, $format);
}
}
diff --git a/core/modules/views/src/Tests/Handler/AreaTextTest.php b/core/modules/views/src/Tests/Handler/AreaTextTest.php
index 2ac78f8..daef86c 100644
--- a/core/modules/views/src/Tests/Handler/AreaTextTest.php
+++ b/core/modules/views/src/Tests/Handler/AreaTextTest.php
@@ -60,16 +60,19 @@ public function testAreaText() {
$this->executeView($view);
$view->display_handler->handlers['header']['area']->options['format'] = $this->randomString();
- $this->assertEqual(array('#markup' => ''), $view->display_handler->handlers['header']['area']->render(), 'Nonexistent format should return empty markup.');
+ $build = $view->display_handler->handlers['header']['area']->render();
+ $this->assertEqual('', drupal_render($build), 'Nonexistent format should return empty markup.');
$view->display_handler->handlers['header']['area']->options['format'] = filter_default_format();
- $this->assertEqual(array('#markup' => check_markup($string)), $view->display_handler->handlers['header']['area']->render(), 'Existant format should return something');
+ $build = $view->display_handler->handlers['header']['area']->render();
+ $this->assertEqual(check_markup($string), drupal_render($build), 'Existent format should return something');
// Empty results, and it shouldn't be displayed .
$this->assertEqual(array(), $view->display_handler->handlers['header']['area']->render(TRUE), 'No result should lead to no header');
// Empty results, and it should be displayed.
$view->display_handler->handlers['header']['area']->options['empty'] = TRUE;
- $this->assertEqual(array('#markup' => check_markup($string)), $view->display_handler->handlers['header']['area']->render(TRUE), 'No result, but empty enabled lead to a full header');
+ $build = $view->display_handler->handlers['header']['area']->render(TRUE);
+ $this->assertEqual(check_markup($string), drupal_render($build), 'No result, but empty enabled lead to a full header');
}
}
diff --git a/core/profiles/standard/config/install/filter.format.basic_html.yml b/core/profiles/standard/config/install/filter.format.basic_html.yml
index 0a9ad13..810a484 100644
--- a/core/profiles/standard/config/install/filter.format.basic_html.yml
+++ b/core/profiles/standard/config/install/filter.format.basic_html.yml
@@ -4,7 +4,6 @@ status: true
weight: 0
roles:
- authenticated
-cache: true
filters:
filter_html:
id: filter_html
@@ -33,4 +32,13 @@ filters:
status: true
weight: 10
settings: { }
+ editor_file_reference:
+ id: editor_file_reference
+ provider: editor
+ status: true
+ weight: 11
+ settings: { }
langcode: en
+dependencies:
+ module:
+ - editor
diff --git a/core/profiles/standard/config/install/filter.format.full_html.yml b/core/profiles/standard/config/install/filter.format.full_html.yml
index 31b6692..9f5ea79 100644
--- a/core/profiles/standard/config/install/filter.format.full_html.yml
+++ b/core/profiles/standard/config/install/filter.format.full_html.yml
@@ -4,7 +4,6 @@ status: true
weight: 1
roles:
- administrator
-cache: true
filters:
filter_caption:
id: filter_caption
@@ -18,4 +17,13 @@ filters:
status: true
weight: 10
settings: { }
+ editor_file_reference:
+ id: editor_file_reference
+ provider: editor
+ status: true
+ weight: 11
+ settings: { }
langcode: en
+dependencies:
+ module:
+ - editor
diff --git a/core/profiles/standard/config/install/filter.format.restricted_html.yml b/core/profiles/standard/config/install/filter.format.restricted_html.yml
index 12a94aa..95a20e5 100644
--- a/core/profiles/standard/config/install/filter.format.restricted_html.yml
+++ b/core/profiles/standard/config/install/filter.format.restricted_html.yml
@@ -4,7 +4,6 @@ status: true
weight: 0
roles:
- anonymous
-cache: true
filters:
filter_html:
id: filter_html