Compact Forms reacts to a $form['#compact_forms'] = FALSE; allowing you to disable compact forms from with a module's hook_form_alter. I would like to be able to do this from within the theme layer, in mytheme_preprocess_form().

However, mytheme_preprocess_form() gets called after compact_forms_form_alter(), and so setting #compact_forms to FALSE there has no effect.

Comments

mrfelton’s picture

In fact, according to #591794: Allow themes to alter forms and page themes can now implement hook_form_alter too. However, this doesn't always work when trying to disable compact forms, since there is no guarantee that my hook_form_alter will run before compact_form's.

Perhaps compact forms should set itself a high module weight, to increase the likelihood of being called after other modules / themes hook_form_alter implementations?

mrfelton’s picture

Actually, theme implementations of hook_form_alter always run after modules, so adjusting the weight would make no difference.