You are here

function vars_node_type in Variable API 6

Same name and namespace in other branches
  1. 6.2 vars.module \vars_node_type()

Implements hook_node_type().

File

./vars.module, line 467
Implement an API to handle persistent variables.

Code

function vars_node_type($op, $info) {
  global $conf;
  if ($op == 'delete') {
    $variables = Vars::loadDefaults('node_type', "flags = %d", Vars::VARS_NODE_TYPE);
    if (array_key_exists('dynamic', $variables)) {
      foreach (array_keys($variables['dynamic']) as $var) {
        db_query("DELETE FROM {variable} WHERE name = '%s'", $var . '_' . $info->type);
        unset($conf[$name]);
        $clear_cache = TRUE;
      }
    }
    if (isset($clear_cache)) {
      cache_clear_all('variables', 'cache');
    }
  }
}