You are here

function fieldgroup_node_type in Content Construction Kit (CCK) 5

Same name and namespace in other branches
  1. 6.3 modules/fieldgroup/fieldgroup.module \fieldgroup_node_type()
  2. 6 modules/fieldgroup/fieldgroup.module \fieldgroup_node_type()
  3. 6.2 modules/fieldgroup/fieldgroup.module \fieldgroup_node_type()

Implementation of hook_node_type() React to change in node types

File

./fieldgroup.module, line 445
Create field groups for CCK fields.

Code

function fieldgroup_node_type($op, $info) {
  if ($op == 'update' && $info->type != $info->old_type) {

    // update the tables
    db_query("UPDATE {node_group} SET type_name='%s' WHERE type_name='%s'", array(
      $info->type,
      $info->old_type,
    ));
    db_query("UPDATE {node_group_fields} SET type_name='%s' WHERE type_name='%s'", array(
      $info->type,
      $info->old_type,
    ));
    cache_clear_all('fieldgroup_data', 'cache_content');
  }
  else {
    if ($op == 'delete') {
      db_query("DELETE FROM {node_group_fields} WHERE type_name = '%s'", $info->type);
      db_query("DELETE FROM {node_group} WHERE type_name = '%s'", $info->type);
    }
  }
}