Greetings,

I found that you invoke form_alter hooks when building a list of fields in content_admin_field_overview_form() function in content_admin.inc file. Here is the code that does it:

  foreach (module_implements('form_alter') as $module) {
    $function = $module .'_form_alter';
    $function($dummy_form_id, $dummy_form);
  }

I have my own project specific module which instantiate form_alter hook and make unset to several fields depending on my own logic (some fields may not be visible in some cases). After I migrated to the latest development release of cck module I found that all fields which are unset by my module disappeared from node type fields admin page.

This is naturaly because my own module unests them, but it is quite confusing. Of course, I can move all that logic into theme function but it is not a good practice to put such things in theme function. Nevertheless, can you suggest any other solution or unseting fields in theme function instead of form_alter hook will go well?

BTW, we did you decide to call form_alter hook of ALL modules to build a fields form? May be only CCK field modules should alter this dummy form or it is impossible to identify that module is a CCK field?

Another quick idea - don't pass $type['type'] .'_node_form' as a dummy form id because it is the same as every node edit form has which is probably bad. Why not to create another ID, so all modules will be able to alter this admin form and these changes not interfere with node edit form changes.

Thanks.

Comments

yched’s picture

Status: Active » Closed (duplicate)

I suggest we keep this discussion in http://drupal.org/node/121385