So, the new way to add stuff to the standard node_edit form is to use hook_form_alter. That's all good and dandy, except that I see no way to alter the alterations.

A concrete example:

Taxonomy has a taxonomy_form_alter function. This function changes the node_edit form to include category items.

However, what if another module wanted to change what taxonomy is adding? I don't see a good way to do that. My investigations indicate that I can't access taxonomy's changes in my own module.

Am I missing something? Or is form_alter not as useful as I thought...

-Mark

Comments

chx’s picture

that's the reason why we added a weight field to the system table. modules are now not called in just an ABC order but by weight. no UI, of course, this is not something users should tamper. but the module developer can set its weight to execute after taxonomy.
--
My developer blog. | The news is Now Public | Ask not what Drupal can do for you -- ask what you can do for Drupal.

--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.

bensheldon’s picture

I searched around and couldn't find any function that sets the module weight. One example of it being done through the install file. Is this the normal manner to set module weight?

harry slaughter’s picture

i'm needing to do the same thing. as you pointed out, devel.install includes the following:

function devel_install() {
  // New module weights in core: put devel as the very last in the chain.
  $ret[] = db_query("UPDATE {system} SET weight = 10 WHERE name = 'devel'");
  // Auto-enable the devel block for fresh installations.
  $ret[] = db_query("INSERT INTO {blocks} (module, delta, theme, status, pages) VALUES ('devel', 1', '%s', 1, '')", variable_get('theme_default', 'bluemarine'));
  return $ret;
}

Assumming this approach is the right one, then you'd need to modify the value by hand and/or in your .install file. no function (yet).

--
Drupal tips, tricks and services
http://devbee.com/ - Effective Drupal

--
Devbee - http://devbee.net/

ymcp’s picture

Did you get anywhere with this?

I have a similar issue here.

baec’s picture

worked for me [drupal 473].

i kept all modules at weight 0 and my brand new custom module at weight 1 so its processed last.
notice setting weight for a module is done by editing manually the "system" table in the drupal database [well thats as far as i know].