function view_custom_table_add_custom_table_to_view_form_validate in Views Custom Table 7
Validate add_custom_table_to_view_form.
1 string reference to 'view_custom_table_add_custom_table_to_view_form_validate'
- view_custom_table_add_custom_table_to_view_form in ./
view_custom_table.admin.inc - Form to add custom table in table information table.
File
- ./
view_custom_table.admin.inc, line 48 - File for administrative functions.
Code
function view_custom_table_add_custom_table_to_view_form_validate($form, &$form_state) {
$values = $form_state['values'];
if (isset($values['table_name'])) {
if (!db_table_exists($values['table_name'])) {
form_set_error('table_name', t('Table "@table" do not exist in database.', array(
'@table' => $values['table_name'],
)));
}
if (db_table_exists('custom_table_view_data')) {
$query = db_select('custom_table_view_data', 'ctvd')
->fields('ctvd', array(
'id',
))
->condition('table_name', $values['table_name']);
$custom_table_id = $query
->execute()
->fetchField();
if ($custom_table_id) {
form_set_error('table_name', t('@table is already available in views.', array(
'@table' => $values['table_name'],
)));
}
}
else {
drupal_set_message(t('"Views Custom Table" module is not installed properly, Please reinstall install it and try again.'), 'error');
}
}
}