diff -u b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php --- b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php +++ b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextItemBase.php @@ -70,16 +70,24 @@ /** * {@inheritdoc} */ - public function prepareCache($properties = array('value')) { - // Where possible, generate the sanitized version of each field early so - // that it is cached in the field cache. This avoids the need to look up the - // field in the filter cache separately. + public function prepareCache() { + // Where possible, generate the sanitized version of each textual property + // (e.g., 'value', 'summary') within this field item early so that it is + // cached in the field cache. This avoids the need to look up the sanitized + // value in the filter cache separately. $text_processing = $this->getFieldSetting('text_processing'); if (!$text_processing || filter_format_allowcache($this->get('format')->getValue())) { $itemBC = $this->getValue(); $langcode = $this->getParent()->getParent()->language()->id; - foreach ($properties as $name) { - $this->set("safe_$name", text_sanitize($text_processing, $langcode, $itemBC, $name)); + // The properties that need sanitizing are the ones that are the 'text + // source' of a TextProcessed computed property. + // @todo Clean up this mess by making the TextProcessed property type + // support its own cache integration: https://drupal.org/node/2026339. + foreach ($this->getPropertyDefinitions() as $definition) { + if (isset($definition['class']) && ($definition['class'] == '\Drupal\text\TextProcessed')) { + $source_property = $definition['settings']['text source']; + $this->set('safe_' . $source_property, text_sanitize($text_processing, $langcode, $itemBC, $source_property)); + } } } } reverted: --- b/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextWithSummaryItem.php +++ a/core/modules/text/lib/Drupal/text/Plugin/field/field_type/TextWithSummaryItem.php @@ -128,11 +128,4 @@ return $element; } - /** - * {@inheritdoc} - */ - public function prepareCache($properties = array('value', 'summary')) { - parent::prepareCache($properties); - } - }