4

I would like to know who's responsible for printing ['safe_value']

$node->body['und'][0]['safe_value']

because for some reasons, it is missing when I checked it using dpm($node), I only see ['value'], ['summary'], and ['format'].

All my modules are up to date and I'm using i18n(multilingual).

2

To augment MZ's answer, while a node_load() will load the node, a node_build_content() is required to get all these extra types of fields. In this case, that would be the Field Module's Text Module that creates this sanitized field based upon the filter in use on that field.

0

Quick grep on standard D7 installation reveals the following:

./modules/field/modules/text/text.module:159:        $items[$id][$delta]['safe_value'] = isset($item['value']) ? _text_sanitize($instances[$id], $langcode, $item, 'value') : '';
./modules/field/field.api.php:321:        $items[$id][$delta]['safe_value'] = isset($item['value']) ? _text_sanitize($instances[$id], $langcode, $item, 'value') : '';
0

The value key "save_value" of "Long Text" fields is set given either of these two is true:

Note that this applies to fields being attached to the node when the node is loaded via node_load() / entity_load(), regardless of whether it's going to be displayed or not.

For display purposes, such as printing the values from the node template, see the field_attach_prepare_view() function which will actually prepare a renderable array, that will apply the proper text format, for the fields attached to the entity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.