function view_custom_table_custom_table_update_relations_form_submit in Views Custom Table 7
Submit handler for view_custom_table_custom_table_update_relations_form()
File
- ./
view_custom_table.admin.inc, line 330 - File for administrative functions.
Code
function view_custom_table_custom_table_update_relations_form_submit($form, &$form_state) {
$values = $form_state['values']['columns'];
$relations = array();
foreach ($values as $column) {
if ($column['entity'] != '') {
$relations[$column['field']] = $column['entity'];
}
}
$serialize_relations = serialize($relations);
if (db_table_exists('custom_table_view_data')) {
if (isset($form_state['table_name'])) {
$query = db_update('custom_table_view_data')
->fields(array(
'column_relations' => $serialize_relations,
))
->condition('table_name', $form_state['table_name'])
->execute();
drupal_set_message(t('Relations for "@table" are updated', array(
'@table' => $form_state['table_name'],
)));
}
drupal_set_message(t("Please clear all cache to start working."));
}
else {
drupal_set_message(t('"Views Custom Table" module is not installed properly, Please reinstall install it and try again.'), 'error');
}
$form_state['redirect'] = 'admin/structure/views/custom_table';
}