You are here

function fieldgroup_node_type in Content Construction Kit (CCK) 6.2

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

Implementation of hook_node_type() React to change in node types

File

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

Code

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

    // update the tables
    db_query("UPDATE {" . fieldgroup_tablename() . "} SET type_name='%s' WHERE type_name='%s'", array(
      $info->type,
      $info->old_type,
    ));
    db_query("UPDATE {" . fieldgroup_fields_tablename() . "} SET type_name='%s' WHERE type_name='%s'", array(
      $info->type,
      $info->old_type,
    ));
    cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
  }
  elseif ($op == 'delete') {
    db_query("DELETE FROM {" . fieldgroup_tablename() . "} WHERE type_name = '%s'", $info->type);
    db_query("DELETE FROM {" . fieldgroup_fields_tablename() . "} WHERE type_name = '%s'", $info->type);
  }
}