By jim_at_miramontes on
I'm starting to explore Drupal 7, and, while getting some custom modules working, have encountered the safe_value property that is now getting created for fields' values, as in $node->field_something['und'][0]['safe_value']. There's rather little documentation on this property (or else I just haven't found it yet); my assumption is that this property contains the display value of the field, properly cleaned via whatever format is appropriate for that field. The intent would seem to be that one can print this value inside a module or other hunk of PHP code without first running it through check_markup.
Is this correct? That would certainly be nice... Thanks!
Comments
I have the same question. And
I have the same question. And also, when and how is safe_value set? What if I want to edit the value for a field? How should I handle it?
I can't find (or maybe there's not) the documentation.
Same question
+1
It's safe to use safe_value ..
I checked the code on this, and the answer is that the safe_value is processed through the function _text_sanitize (in /modules/field/modules/text/text.module). This function clearly uses check_markup(), so safe_value can safely be used.
Good news!
Thanks very much for tracking this down!
Excellent!
I had the same question. Thanks for nice clarification.