Project

General

Profile

« Previous | Next » 

Revision 49ea01c8

Added by Lorna Morris over 12 years ago

added function dwca_export_config_form_validate to report an error if user has entered a view that doesn't exist.

View differences:

7.x/modules/dwca_export/dwca_export.module
131 131
	
132 132
	variable_del(FILE_MAP);
133 133
	variable_set(FILE_MAP, $dwca_export_archive_descriptor_file_map);
134
		
135
	//drupal_set_message(t('The classification view is ') . $save_variables);// . '<pre>' . print_r($form_state,true) . '</pre>');//$save_variables);
136
}
137

  
138
// TODO: Modify this so it reports errors in multiple fields. Currently it form_set_error will only indicate if a single view does not exist
139
function dwca_export_config_form_validate($form, &$form_state) {
134 140
	
141
	$variables = $form_state['input'];
142
	$dwca_export_archive_descriptor_file_map = variable_get(FILE_MAP);
143
	$view_names = array();
144
	
145
	foreach ($variables as $key => $value) {
146
		
147
		if (array_key_exists($key, $dwca_export_archive_descriptor_file_map)) {
148
			//if ($value = 'dwca_export_classification') {
149
					
150
			$view = views_get_view($value);
151
			// check whether there is a view named with this value 
152
			if(!$view) {
153
				form_set_error('', t('This view - ' . $value . ' - does not exist. Please input another view name.'));
154
			}
155
		}
156
	}
135 157
	
136
	//drupal_set_message(t('The classification view is ') . $save_variables . '<pre>' . print_r($form_state,true) . '</pre>');//$save_variables);
137

  
138 158
}
139 159

  
140

  
141 160
/**
142 161
 * menu callback
143 162
 */

Also available in: Unified diff