4

Is it possible to change the text-format (display output only) of a long-text field through the theme in Drupal 7? Similar to the way you can override the imagecache output for an image. The reason I don't want to change the database value is because the user role doesn't have permission for the desired output (full_html), but I'd like to have this output on a specific content-type - benefit 2 is that the user doesn't have the input/text format options on the form.

1 Answer 1

3

First of all you should be aware that if you were to display the input of a input like is was full HTML, it would be the same thing as giving the user who created the content access to using the full HTML filter. The only difference is that you wont tell the user that he can type full HTML. This could potentially open your site to exploits, if people write harmful HTML. You should instead give users access to the filters that you want to use for their input.

Now if you want to display any text through any filter, you can do that by using check_markup. You simply pass the text and filter id to the function and it will return a text you can use on your site.

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.