I'm changing the content of an HTML field using entity_metadata_wrapper, and I see 3 values, like value, format, and safe_value.

My question is if I have to also edit safe_value or it will be generated dynamically. Thanks

PS: I edited and saved only value then in next load, the other were empty. I went to the node and clicked Save and the safe value was regenerated. Maybe I should call a hook after editing value? Currently I'm using the check_markup function to generate the safe_value from the modified value


Yes. safe_value is derived from value; safe_value contains the results of _text_sanitize() after it applies all the filters you've set on your text field.

It isn't set after a node save; it's set on a field load; the field module loads it via hook_field_load() with its text_field_load() invocation.

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.