Submitted by CrashTest_ on Sat, 05/16/2009 - 23:42
Ok, there are a couple of things in Drupal that I pound my head against on a regular basis, and overriding CCK fields using hook_form_alter in a custom module is one of them. You write the code, but you don't see any changes. Weird? Oh yeah.
Come to find out from this excellent blog post that I wasn't the only one to experience this. It stems from the module weight of your module as compared to CCK. The fix is to write a simple .install file for your module and set the weight:
<?php
/**
* Fix module weight to be heavier than CCK field group module,
* so hook_form_alter() has access to field groups
*/
function my_custom_module_update_1() {
$items = array();
$items[] = update_sql("UPDATE {system} SET weight = 10 WHERE `name` = 'my_custom_module';");
drupal_set_message('Updated custom module weight.');
return $items;
} ?>So, let's all remember, leave the hairs on your head, just adjust your module weight!
Thanks Andy!


I know I encountered the
I know I encountered the #access attribute at some point in the past, but I had quite forgotten about it. Definitely the more "Drupalish" way to go about it!