function entity_metadata_field_text_get in Entity API 7
Callback for getting the sanitized text of 'text_formatted' properties. This callback is used for both the 'value' and the 'summary'.
1 string reference to 'entity_metadata_field_text_get'
- entity_property_text_formatted_info in includes/
entity.property.inc - Defines info for the properties of the text_formatted data structure.
File
- modules/
callbacks.inc, line 592 - Provides various callbacks for the whole core module integration.
Code
function entity_metadata_field_text_get($item, array $options, $name, $type, $context) {
// $name is either 'value' or 'summary'.
if (!isset($item['safe_' . $name])) {
// Apply input formats.
$langcode = isset($options['language']) ? $options['language']->language : '';
$format = isset($item['format']) ? $item['format'] : filter_default_format();
$item['safe_' . $name] = check_markup($item[$name], $format, $langcode);
// To speed up subsequent calls, update $item with the 'safe_value'.
$context['parent']
->set($item);
}
return $item['safe_' . $name];
}