You are here

function fe_taxonomy_taxonomy in Features Extra 6

Implementation of hook_taxonomy().

File

./fe_taxonomy.module, line 220

Code

function fe_taxonomy_taxonomy($op, $type, $array = NULL) {
  if ($type != 'vocabulary' || !user_access('administer features')) {
    return;
  }
  $table = 'fe_taxonomy_vocabulary';
  switch ($op) {
    case 'insert':
    case 'update':
      if (isset($array['machine_name'])) {
        db_query("DELETE FROM {{$table}} WHERE vid = %d", $array['vid']);
        if (!empty($array['machine_name'])) {
          drupal_write_record($table, $array);
        }
      }
      if (!empty($array['vocab_module']) && $array['vocab_module'] != 'taxonomy') {
        $values = array(
          'vid' => $array['vid'],
          'module' => $array['vocab_module'],
        );
        drupal_write_record('vocabulary', $values, 'vid');
      }
      break;
    case 'delete':
      db_query("DELETE FROM {{$table}} WHERE vid = %d", $array['vid']);
      break;
  }
}