Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Berdir on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Introduced in version:
8.0-alpha3
Description:
The helper function text_sanitize() (_text_sanitize() in 7.x) has been removed together with the safe_value and safe_summary properties of text field items.
Instead, the processed and summary_processed (for text with summary field items) can be used, which are computed properties that are always present.
Before
7.x
$summary = _text_sanitize($field_instance, $langcode, $item, 'summary');
8.0-alpha3 and older
$value = text_sanitize($instance['settings']['text_processing'], $node->language()->id, $node->body[0]->getValue(), 'value');
After
8.x
$value = $node->body->processed;
$summary = $node->body->processed_summary;
$summary = _text_sanitize($field_instance, $langcode, $item, 'summary');
$value = text_sanitize($instance['settings']['text_processing'], $node->language()->id, $node->body[0]->getValue(), 'value');
$value = $node->body->processed;
$summary = $node->body->processed_summary;
Impacts:
Module developers