Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function _text_sanitize

Sanitizes the 'value' or 'summary' data of a text value.

Depending on whether the field instance uses text processing, data is run through check_plain() or check_markup().

Parameters

$instance: The instance definition.

$langcode: The language associated to $item.

$item: The field value to sanitize.

$column: The column to sanitize (either 'value' or 'summary').

Return value

The sanitized string.

7 calls to _text_sanitize()
CommentTokenReplaceTestCase::testCommentTokenReplacement in modules/comment/comment.test
Creates a comment, then tests the tokens generated from it.
comment_tokens in modules/comment/comment.tokens.inc
Implements hook_tokens().
hook_field_load in modules/field/field.api.php
Define custom load behavior for this module's field types.
NodeTokenReplaceTestCase::testNodeTokenReplacement in modules/node/node.test
Creates a node, then tests the tokens generated from it.
node_tokens in modules/node/node.tokens.inc
Implements hook_tokens().

... See full list

File

modules/field/modules/text/text.module, line 315

Code

function _text_sanitize ($instance, $langcode, $item, $column) {
 // If the value uses a cacheable text format, text_field_load() precomputes
 // the sanitized string.
 if (isset($item["safe_{$column}"])) {
 return $item["safe_{$column}"];
 }
 if ($item[$column] === '') {
 return '';
 }
 return $instance['settings']['text_processing'] ? check_markup ($item[$column], $item['format'], $langcode) : check_plain ($item[$column]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.