You are here

function view_custom_table_edit_custom_table_form_validate in Views Custom Table 7

Function to validate custom table description.

1 string reference to 'view_custom_table_edit_custom_table_form_validate'
view_custom_table_edit_custom_table_form in ./view_custom_table.admin.inc
Function to edit custom table description.

File

./view_custom_table.admin.inc, line 226
File for administrative functions.

Code

function view_custom_table_edit_custom_table_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')) {
      if (strlen($values['table_description']) > 255) {
        form_set_error('table_description', t('Description can not be longer then 255.'));
      }
    }
    else {
      drupal_set_message(t('"Views Custom Table" module is not installed properly, Please reinstall install it and try again.'), 'error');
    }
  }
}