diff --git a/core/modules/book/src/Tests/BookTest.php b/core/modules/book/src/Tests/BookTest.php index 2e6e851..81dc69f 100644 --- a/core/modules/book/src/Tests/BookTest.php +++ b/core/modules/book/src/Tests/BookTest.php @@ -218,7 +218,7 @@ function checkBookNode(EntityInterface $node, $nodes, $previous = FALSE, $up = F // Check printer friendly version. $this->drupalGet('book/export/html/' . $node->id()); $this->assertText($node->label(), 'Printer friendly title found.'); - $this->assertRaw($node->body->processed, 'Printer friendly body found.'); + $this->assertRaw($node->body->filtered, 'Printer friendly body found.'); $number++; } @@ -295,7 +295,7 @@ function testBookExport() { // Make sure each part of the book is there. foreach ($nodes as $node) { $this->assertText($node->label(), 'Node title found in printer friendly version.'); - $this->assertRaw($node->body->processed, 'Node body found in printer friendly version.'); + $this->assertRaw($node->bod->filtered, 'Node body found in printer friendly version.'); } // Make sure we can't export an unsupported format. diff --git a/core/modules/comment/comment.tokens.inc b/core/modules/comment/comment.tokens.inc index b34fdcb..3ca4e7f 100644 --- a/core/modules/comment/comment.tokens.inc +++ b/core/modules/comment/comment.tokens.inc @@ -159,7 +159,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options = break; case 'body': - $replacements[$original] = $sanitize ? $comment->comment_body->processed : $comment->comment_body->value; + $replacements[$original] = $sanitize ? $comment->comment_body->filtered : $comment->comment_body->value; break; // Comment related URLs. diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php index 075e463..a04405a 100644 --- a/core/modules/comment/src/CommentForm.php +++ b/core/modules/comment/src/CommentForm.php @@ -327,7 +327,7 @@ public function submit(array $form, FormStateInterface $form_state) { // 1) Filter it into HTML // 2) Strip out all HTML tags // 3) Convert entities back to plain-text. - $comment_text = $comment->comment_body->processed; + $comment_text = $comment->comment_body->filtered; $comment->setSubject(Unicode::truncate(trim(String::decodeEntities(strip_tags($comment_text))), 29, TRUE)); // Edge cases where the comment body is populated only by HTML tags will // require a default subject. diff --git a/core/modules/comment/src/Tests/CommentTokenReplaceTest.php b/core/modules/comment/src/Tests/CommentTokenReplaceTest.php index 97335f8..d31f7f4 100644 --- a/core/modules/comment/src/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/src/Tests/CommentTokenReplaceTest.php @@ -56,7 +56,7 @@ function testCommentTokenReplacement() { $tests['[comment:mail]'] = String::checkPlain($this->admin_user->getEmail()); $tests['[comment:homepage]'] = check_url($comment->getHomepage()); $tests['[comment:title]'] = Xss::filter($comment->getSubject()); - $tests['[comment:body]'] = $comment->comment_body->processed; + $tests['[comment:body]'] = $comment->comment_body->filtered; $tests['[comment:url]'] = url('comment/' . $comment->id(), $url_options + array('fragment' => 'comment-' . $comment->id())); $tests['[comment:edit-url]'] = url('comment/' . $comment->id() . '/edit', $url_options); $tests['[comment:created:since]'] = \Drupal::service('date.formatter')->formatInterval(REQUEST_TIME - $comment->getCreatedTime(), 2, $language_interface->id); diff --git a/core/modules/quickedit/src/Tests/EditorSelectionTest.php b/core/modules/quickedit/src/Tests/EditorSelectionTest.php index 56c0209..380c934 100644 --- a/core/modules/quickedit/src/Tests/EditorSelectionTest.php +++ b/core/modules/quickedit/src/Tests/EditorSelectionTest.php @@ -8,7 +8,6 @@ namespace Drupal\quickedit\Tests; use Drupal\Core\Language\LanguageInterface; -use Drupal\quickedit\Plugin\InPlaceEditorManager; use Drupal\quickedit\EditorSelector; /** @@ -50,8 +49,7 @@ protected function getSelectedEditor($entity_id, $field_name, $view_mode = 'defa } /** - * Tests a textual field, without/with text filtering, with cardinality 1 and - * >1, always without a WYSIWYG editor present. + * Tests a string (plain text) field, with cardinality 1 and >1. */ public function testText() { $field_name = 'field_text'; @@ -72,13 +70,13 @@ public function testText() { $entity->{$field_name}->value = 'Hello, world!'; $entity->save(); - // Editor selection without text processing, with cardinality 1. - $this->assertEqual('plain_text', $this->getSelectedEditor($entity->id(), $field_name), "Without text processing, cardinality 1, the 'plain_text' editor is selected."); + // With cardinality 1. + $this->assertEqual('plain_text', $this->getSelectedEditor($entity->id(), $field_name), "With cardinality 1, the 'plain_text' editor is selected."); - // Editor selection without text processing, cardinality >1 + // With cardinality >1 $this->fields->field_text_field_storage->cardinality = 2; $this->fields->field_text_field_storage->save(); - $this->assertEqual('form', $this->getSelectedEditor($entity->id(), $field_name), "Without text processing, cardinality >1, the 'form' editor is selected."); + $this->assertEqual('form', $this->getSelectedEditor($entity->id(), $field_name), "With cardinality >1, the 'form' editor is selected."); } @@ -120,7 +118,7 @@ public function testTextWysiwyg() { $entity->save(); $this->assertEqual('wysiwyg', $this->getSelectedEditor($entity->id(), $field_name), "With cardinality 1, and the full_html text format, the 'wysiwyg' editor is selected."); - // Editor selection with text processing, cardinality >1 + // Editor selection with text field, cardinality >1. $this->fields->field_textarea_field_storage->cardinality = 2; $this->fields->field_textarea_field_storage->save(); $this->assertEqual('form', $this->getSelectedEditor($entity->id(), $field_name), "With cardinality >1, and both items using the full_html text format, the 'form' editor is selected."); diff --git a/core/modules/rdf/src/Tests/Field/StringFieldRdfaTest.php b/core/modules/rdf/src/Tests/Field/StringFieldRdfaTest.php index 31df8a3..92be1d6 100644 --- a/core/modules/rdf/src/Tests/Field/StringFieldRdfaTest.php +++ b/core/modules/rdf/src/Tests/Field/StringFieldRdfaTest.php @@ -47,7 +47,6 @@ public function setUp() { $this->entity = entity_create('entity_test'); $this->entity->{$this->fieldName}->value = $this->testValue; $this->entity->{$this->fieldName}->summary = $this->testSummary; - } /** diff --git a/core/modules/rdf/src/Tests/Field/TextFieldRdfaTest.php b/core/modules/rdf/src/Tests/Field/TextFieldRdfaTest.php index e0d36b9..85da5f2 100644 --- a/core/modules/rdf/src/Tests/Field/TextFieldRdfaTest.php +++ b/core/modules/rdf/src/Tests/Field/TextFieldRdfaTest.php @@ -65,13 +65,13 @@ protected function setUp() { * @todo Check for the summary mapping. */ public function testAllFormatters() { - $formatted_value = strip_tags($this->entity->{$this->fieldName}->processed); + $filtered_value = strip_tags($this->entity->{$this->fieldName}->processed); // Tests the default formatter. - $this->assertFormatterRdfa(array('type'=>'text_default'), 'http://schema.org/text', array('value' => $formatted_value)); + $this->assertFormatterRdfa(array('type'=>'text_default'), 'http://schema.org/text', array('value' => $filtered_value)); // Tests the summary formatter. - $this->assertFormatterRdfa(array('type'=>'text_summary_or_trimmed'), 'http://schema.org/text', array('value' => $formatted_value)); + $this->assertFormatterRdfa(array('type'=>'text_summary_or_trimmed'), 'http://schema.org/text', array('value' => $filtered_value)); // Tests the trimmed formatter. - $this->assertFormatterRdfa(array('type'=>'text_trimmed'), 'http://schema.org/text', array('value' => $formatted_value)); + $this->assertFormatterRdfa(array('type'=>'text_trimmed'), 'http://schema.org/text', array('value' => $filtered_value)); } } diff --git a/core/modules/text/config/schema/text.schema.yml b/core/modules/text/config/schema/text.schema.yml index aad5f5b..fd46b4a 100644 --- a/core/modules/text/config/schema/text.schema.yml +++ b/core/modules/text/config/schema/text.schema.yml @@ -37,16 +37,14 @@ field.text.value: label: 'Text format' field.text_long.settings: - type: sequence label: 'Settings' - sequence: - - type: string + type: mapping + mapping: { } field.text_long.instance_settings: - type: mapping label: 'Text (filtered, long) settings' - sequence: - - type: string + type: mapping + mapping: { } field.text_long.value: type: sequence @@ -63,10 +61,9 @@ field.text_long.value: label: 'Text format' field.text_with_summary.settings: - type: sequence label: 'Default' - sequence: - - type: string + type: mapping + mapping: { } field.text_with_summary.instance_settings: type: mapping diff --git a/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php b/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php index f19c727..385d25f 100644 --- a/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php +++ b/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php @@ -26,11 +26,11 @@ public static function propertyDefinitions(FieldStorageDefinitionInterface $fiel $properties['format'] = DataDefinition::create('filter_format') ->setLabel(t('Text format')); - $properties['processed'] = DataDefinition::create('string') - ->setLabel(t('Processed text')) + $properties['filtered'] = DataDefinition::create('string') + ->setLabel(t('Filtered text')) ->setDescription(t('The text value with the text format applied.')) ->setComputed(TRUE) - ->setClass('\Drupal\text\TextProcessed') + ->setClass('\Drupal\text\TextFiltered') ->setSetting('text source', 'value'); return $properties; diff --git a/core/modules/text/src/Tests/Formatter/TextFormatterTest.php b/core/modules/text/src/Tests/Formatter/TextFormatterTest.php index 538928f..ef71160 100644 --- a/core/modules/text/src/Tests/Formatter/TextFormatterTest.php +++ b/core/modules/text/src/Tests/Formatter/TextFormatterTest.php @@ -55,7 +55,7 @@ protected function setUp() { ))->save(); entity_create('field_storage_config', array( - 'name' => 'processed_text', + 'name' => 'filtered_text', 'entity_type' => $this->entityType, 'type' => 'text', 'settings' => array(), @@ -63,8 +63,8 @@ protected function setUp() { entity_create('field_instance_config', array( 'entity_type' => $this->entityType, 'bundle' => $this->bundle, - 'field_name' => 'processed_text', - 'label' => 'Processed text', + 'field_name' => 'filtered_text', + 'label' => 'Filtered text', ))->save(); } @@ -87,7 +87,7 @@ public function testFormatters() { $entity->save(); foreach ($formatters as $formatter) { - // Verify the processed text field formatter's render array. + // Verify the 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( diff --git a/core/modules/text/src/TextProcessed.php b/core/modules/text/src/TextProcessed.php deleted file mode 100644 index d06ce01..0000000 --- a/core/modules/text/src/TextProcessed.php +++ /dev/null @@ -1,75 +0,0 @@ -getSetting('text source') === NULL) { - throw new \InvalidArgumentException("The definition's 'text source' key has to specify the name of the text property to be processed."); - } - } - - /** - * Implements \Drupal\Core\TypedData\TypedDataInterface::getValue(). - */ - public function getValue($langcode = NULL) { - if ($this->processed !== NULL) { - return $this->processed; - } - - $item = $this->getParent(); - $text = $item->{($this->definition->getSetting('text source'))}; - - // Avoid running check_markup() or - // \Drupal\Component\Utility\String::checkPlain() on empty strings. - if (!isset($text) || $text === '') { - $this->processed = ''; - } - else { - $this->processed = check_markup($text, $item->format, $item->getLangcode()); - } - return $this->processed; - } - - /** - * Implements \Drupal\Core\TypedData\TypedDataInterface::setValue(). - */ - public function setValue($value, $notify = TRUE) { - $this->processed = $value; - // Notify the parent of any changes. - if ($notify && isset($this->parent)) { - $this->parent->onChange($this->name); - } - } - -}