The code in the function better_formats_form_alter in the file better_formats.module overwrites for example the content of $form['comment_filter']['format'] which may be already altered by another module (i.e. pingback). To solve this it would be really great to re-implement the form_alter hook after the variable $form is changed. I´ve posted a possible solution in german at:

http://blog-das-oertchen.de/de/blog/2010/07/28/drupal-better-formats

Greats from Germany
LeisureLarry

Comments

dragonwize’s picture

Category: bug » support
Status: Active » Closed (won't fix)

Well I can't read german but this is not a bug, just a normal use of how Drupal's system works. Any module modifying the same part of a form goes through Drupal's module weight system and ran in that order for each alter hook.

BF handles the format no matter if a form is changed or not. Your solution if I understand it would only serve to disable BF's changes in favor of your own. The proper way to do that is not for me to alter my module but for you to alter your module to run after BF by setting its weight higher.

LeisureLarry’s picture

My solution reimplements the original hook so that all modules may alter the form after you reset the formats. Therefore modules are able to change the form after you´ve done your changes without needing to change a weight which an end user cannot change (as far as I know). This allows all modules to hide internal used formats without needing to change each module.

A better way would be if your module would always be the first executed for this hook, but I have no idea how to archive this.

LeisureLarry’s picture

Status: Closed (won't fix) » Active

I´ve thought some hours about my solution and dropped it. After that I´ve googled some time concerning weight and hooks.

Would it be possible to change your code in better_formats.install function better_formats_install() and use the following solution instead?

http://snipplr.com/view/4449/assure-hooks-in-a-drupal-module-are-ran-bef...

Greats from Germany
LeisureLarry

dragonwize’s picture

Status: Active » Closed (won't fix)

I have set BF's weight to run after modules the BF needs to run after to prevent conflicts.

If you have a module, or know of a module, that has a weight conflict with BF then file an issue with that module asking them to increase their weight above BF.

Every module has to arrange itself before and after other modules as it needs to work properly.

This is not for an end user to do. However, there is a module that will allow site admins to adjust the weight in the interface but I would highly not suggest using it unless you really know what you are doing. It is best to work with the module maintainers as we all do not run every combination and rely on users to report.