You are here

function maxlength_node_type in Maxlength 6

Same name and namespace in other branches
  1. 5.2 maxlength.module \maxlength_node_type()
  2. 5 maxlength.module \maxlength_node_type()
  3. 6.2 maxlength.module \maxlength_node_type()

Implemenation of hook_node_type().

File

./maxlength.module, line 224

Code

function maxlength_node_type($op, $info) {
  switch ($op) {
    case 'delete':
      $code = MAXLENGTH_NODE_TYPE . $info->type;
      variable_del($code . '_t');
      variable_del($code . '_b');
      break;
    case 'update':
      if (!empty($info->old_type) && $info->old_type != $info->type) {
        $code_old = MAXLENGTH_NODE_TYPE . $info->old_type;
        $code_new = MAXLENGTH_NODE_TYPE . $info->type;
        $max_title = variable_get($code_old . '_t', '');
        $max_body = variable_get($code_old . '_b', '');
        variable_set($code_new . '_t', $max_title);
        variable_set($code_new . '_b', $max_body);
        variable_del($code_old . '_t');
        variable_del($code_old . '_b');
      }
      break;
  }
}