31

What are the differences between ['value'] and ['safe_value']?

3 Answers 3

24

It is a value, passed through the function _text_sanitize(). You can read more in the official docs.

If you are using 'safe_value', you may be also interested in this article: Rendering Drupal 7 fields (the right way).

0
16

The main difference it that the safe_value is passed through the function _text_sanitize().

2
  • 3
    At the same time :)
    – kalabro
    Commented Aug 31, 2011 at 12:14
  • 1
    Depending on the type of value you want in safe_value, you can forego the use of _text_sanitize() and use check_plain($text) for plain text or check_markup($text, $format) for HTML Commented Nov 20, 2014 at 12:21
1

For Readers benefit, DO NOT use safe_value data when making SQL statements. In other words, strings containing ampersand ( & ) will become ( & ) fail to get the expected results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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