t('UbicaciĆ³n'), 'machine_name' => 'ubicacion', 'description' => t('Lista de Entidades, municipios y parroquias de Venezuela'), 'hierarchy' => 1, 'module' => 'ente_planificador', 'weight' => -10, ); $vocabulary = $edit; taxonomy_save_vocabulary($vocabulary); variable_set('ente_ubicacion_vocabulary', $vocabulary['vid']); $vocabulary = (object) $vocabulary; } //create field codigo $field_code_geo = array( 'fid' => 'codigo_geo_localizacion', 'title' => 'Codigo', 'description' => '', 'required' => 0, 'weight' => 0, 'type' => 'text', 'options' => array( 'default' => array( 'value' => '', ), 'max_length' => '', 'size' => '', ), 'widget' => 'textfield', 'vid' => $vocabulary->vid, ); $field = (object) $field_code_geo; $field->options = array(); $field->module = 'ente_planificador_term_fields'; if ($field_info = term_fields_get_fields_info($field->type)) { $field->module = $field_info['module']; } else { drupal_set_message(t('An error occured while saving the new field %title (%field). If such error persists, please contact a site administrator.', array('%title' => $field->title, '%field' => $field->fid)), 'error'); return; } // Flag the fiels as instantiated. if (empty($field->instantiated)) { $field->instantiated = 1; } drupal_write_record('term_fields', $field); drupal_write_record('term_fields', $field, array('fid')); drupal_write_record('term_fields_instance', $field, array('fid', 'vid')); // Get the new columns if any. $columns = module_invoke($field->module, 'term_fields_api', 'storage', $field); //add new field in table if (!db_column_exists('term_fields_term', $field->fid)) { $name = 'codigo_geo_localizacion_value'; foreach ($columns as $column) { db_add_field($ret, 'term_fields_term', $name, $column); } } } /* * Implementation of hook_uninstall */ function ente_planificador_term_fields_uninstall() { // Load the dependent Taxonomy module, in case it has been disabled. variable_del('ente_ubicacion_vocabulary'); }