The FAPI type 'text_format' has both a #default value *and* a #format. I wasn't able to figure out how to populate two separate things here. Is there an example, or course we please support text_format?

I was trying this in the patch in #1261012-10: Add Variable module integration for custom checkout completion messages

Comments

nlambert’s picture

+1

adam1’s picture

+1

cyberwolf’s picture

StatusFileSize
new1.06 KB

We've built a module which adds a text_format variable type. Please find it attached.
It has to use an ugly form_alter though to solve the #format problem.

Credits to HnLn (http://drupal.org/user/312837) for providing some initial code for this.

cyberwolf’s picture

Status: Active » Needs review
StatusFileSize
new1.17 KB

I was able to replace the hook_form_FORM_ID_alter() implementation with an element callback.
Also added a default callback.

Any chance the variable module wants to adopt this code? Then I'll provide a patch.

rfay’s picture

I can't speak for the maintainers, but would very much appreciate a patch... and would be surprised if the maintainers didn't want one.

cyberwolf’s picture

StatusFileSize
new4.03 KB

Attached is a patch for the variable module.

guillaumev’s picture

Status: Needs review » Reviewed & tested by the community

I just tested this and it's working fine... RTBC ?

guillaumev’s picture

StatusFileSize
new4.93 KB

Here is an updated patch with the possibility for users to set default values for their text_format variables (see default value callback)

jose reyero’s picture

Status: Reviewed & tested by the community » Fixed

Nice!

Committed, thanks.

cyberwolf’s picture

Great to see this getting in. Thanks guys!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.