31

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

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).

16

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

  • 3
    At the same time :) – kalabro Aug 31 '11 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 – Agi Hammerthief Nov 20 '14 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, privacy policy and cookie policy

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