$proyectos_operativos_inserts['field_name'], 'type_name' => $proyectos_operativos_inserts['type_name'] )); if (count($instances)) { $remove_field = TRUE; // Only add the field if it doesn't exist. Don't overwrite any changes. content_field_instance_delete($proyectos_operativos_inserts['field_name'], $proyectos_operativos_inserts['type_name']); drupal_set_message(t("Removed field %typefield in content type %typecontent", array('%typefield' => $proyectos_operativos_inserts['label'], '%typecontent' => $proyectos_operativos_inserts['type_name']))); } } } if ($remove_field) { content_clear_type_cache(TRUE); menu_rebuild(); } } /* * _continuarproyectosopplurianual_install_type_create_field * Crear los tipos de contenidos necesarios para el funcionamiento del modulo */ function _continuarproyectosopplurianual_install_type_create_field() { // Load fields. $proyectos_operativos_fields = _continuarproyectosopplurianual_load_fields(); $create_field = FALSE; if (count($proyectos_operativos_fields['fields'])) { foreach ($proyectos_operativos_fields['fields'] as $proyectos_operativos_inserts) { $instances = content_field_instance_read(array( 'field_name' => $proyectos_operativos_inserts['field_name'], 'type_name' => $proyectos_operativos_inserts['type_name'] )); if (count($instances) < 1) { $create_field = TRUE; // Only add the field if it doesn't exist. Don't overwrite any changes. $field_create = content_field_instance_create($proyectos_operativos_inserts, FALSE); drupal_set_message(t("Saved field %typefield in content type %typecontent", array('%typefield' => $proyectos_operativos_inserts['label'], '%typecontent' => $proyectos_operativos_inserts['type_name']))); } } } if ($create_field) { content_clear_type_cache(TRUE); menu_rebuild(); } } /* * _continuarproyectosopplurianual_load_fields * Crear los tipos de contenidos necesarios para el funcionamiento del modulo */ function _continuarproyectosopplurianual_load_fields() { $content = array(); $content['fields'] = array(); $content['fields'][] = array ( 'label' => 'Proyecto Plurianual', 'type_name' => 'proyectos_operativos', 'field_name' => 'field_proyecto_plurianualb', 'type' => 'nodereference', 'widget_type' => 'nodereference_autocomplete', 'change' => 'Cambiar información básica', 'weight' => '70', 'autocomplete_match' => 'contains', 'size' => '60', 'description' => '', 'default_value' => array ( 0 => array ( 'nid' => NULL, '_error_element' => 'default_value_widget][field_proyecto_plurianualb][0][nid][nid', ), ), 'default_value_php' => '', 'default_value_widget' => NULL, 'group' => false, 'required' => 0, 'multiple' => '0', 'referenceable_types' => array ( 'proyectos_operativos' => 'proyectos_operativos', 'accion_centralizada' => 0, 'accion_especifica' => 0, 'activity' => 0, 'ente_planificador' => 0, 'page' => 0, 'story' => 0, ), 'advanced_view' => '--', 'advanced_view_args' => '', 'op' => 'Guardar configuraciones del campo', 'module' => 'nodereference', 'widget_module' => 'nodereference', 'columns' => array ( 'nid' => array ( 'type' => 'int', 'unsigned' => true, 'not null' => false, 'index' => true, ), ), 'display_settings' => array ( 'label' => array ( 'format' => 'above', 'exclude' => 0, ), 'teaser' => array ( 'format' => 'default', 'exclude' => 0, ), 'full' => array ( 'format' => 'default', 'exclude' => 0, ), 4 => array ( 'format' => 'default', 'exclude' => 0, ), 'token' => array ( 'format' => 'default', 'exclude' => 0, ), ), ); $content['fields'][] = array ( 'label' => 'Acción Especifica Plurianual', 'type_name' => 'accion_especifica', 'field_name' => 'field_ae_plurianualb', 'type' => 'nodereference', 'widget_type' => 'nodereference_autocomplete', 'change' => 'Cambiar información básica', 'weight' => '70', 'autocomplete_match' => 'contains', 'size' => '60', 'description' => '', 'default_value' => array ( 0 => array ( 'nid' => NULL, '_error_element' => 'default_value_widget][field_ae_plurianualb][0][nid][nid', ), ), 'default_value_php' => '', 'default_value_widget' => NULL, 'group' => false, 'required' => 0, 'multiple' => '0', 'referenceable_types' => array ( 'proyectos_operativos' => 0, 'accion_centralizada' => 0, 'accion_especifica' => 'accion_especifica', 'activity' => 0, 'ente_planificador' => 0, 'page' => 0, 'story' => 0, ), 'advanced_view' => '--', 'advanced_view_args' => '', 'op' => 'Guardar configuraciones del campo', 'module' => 'nodereference', 'widget_module' => 'nodereference', 'columns' => array ( 'nid' => array ( 'type' => 'int', 'unsigned' => true, 'not null' => false, 'index' => true, ), ), 'display_settings' => array ( 'label' => array ( 'format' => 'above', 'exclude' => 0, ), 'teaser' => array ( 'format' => 'default', 'exclude' => 0, ), 'full' => array ( 'format' => 'default', 'exclude' => 0, ), 4 => array ( 'format' => 'default', 'exclude' => 0, ), 'token' => array ( 'format' => 'default', 'exclude' => 0, ), ), ); $content['fields'][] = array ( 'label' => 'Proyecto operativo Plurianual', 'type_name' => 'accion_especifica', 'field_name' => 'field_ae_proyectobase', 'type' => 'nodereference', 'widget_type' => 'nodereference_autocomplete', 'change' => 'Cambiar información básica', 'weight' => '70', 'autocomplete_match' => 'contains', 'size' => '60', 'description' => '', 'default_value' => array ( 0 => array ( 'nid' => NULL, '_error_element' => 'default_value_widget][field_ae_proyectobase][0][nid][nid', ), ), 'default_value_php' => '', 'default_value_widget' => NULL, 'group' => false, 'required' => 0, 'multiple' => '0', 'referenceable_types' => array ( 'proyectos_operativos' => 'proyectos_operativos', 'accion_centralizada' => 0, 'accion_especifica' => 0, 'activity' => 0, 'ente_planificador' => 0, 'page' => 0, 'story' => 0, ), 'advanced_view' => '--', 'advanced_view_args' => '', 'op' => 'Guardar configuraciones del campo', 'module' => 'nodereference', 'widget_module' => 'nodereference', 'columns' => array ( 'nid' => array ( 'type' => 'int', 'unsigned' => true, 'not null' => false, 'index' => true, ), ), 'display_settings' => array ( 'label' => array ( 'format' => 'above', 'exclude' => 0, ), 'teaser' => array ( 'format' => 'default', 'exclude' => 0, ), 'full' => array ( 'format' => 'default', 'exclude' => 0, ), 4 => array ( 'format' => 'default', 'exclude' => 0, ), 'token' => array ( 'format' => 'default', 'exclude' => 0, ), ), ); return $content; }