function node_gallery_relationship_content_types_form_submit in Node Gallery 6.3
Submit handler for relationship settings form
_state
Parameters
$form:
File
- ./
node_gallery.admin.inc, line 443
Code
function node_gallery_relationship_content_types_form_submit($form, &$form_state) {
$r = (object) $form['#relationship'];
$send_to_settings_form = FALSE;
foreach ($form_state['values']['relationship'] as $k => $v) {
if ($r->{$k} != $v) {
$r->{$k} = $v;
if ($k == 'image_type' && $r->{k}) {
// They need to update the imagefield setting if they change image types
$send_to_settings_form = TRUE;
drupal_set_message(t('Image content type changed, please verify the Image storage field below.'), 'warning');
}
}
}
if (!isset($r->rid)) {
//New relationship
$r->settings = node_gallery_relationship_settings_defaults();
$r->imagefield_name = '';
$send_to_settings_form = TRUE;
drupal_write_record('node_gallery_relationships', $r);
menu_cache_clear_all();
drupal_set_message(t('Default settings applied, please verify the Image storage field below.'), 'warning');
}
else {
drupal_write_record('node_gallery_relationships', $r, 'rid');
menu_cache_clear_all();
drupal_set_message(t('Node Gallery relationship updated'));
}
if ($send_to_settings_form) {
$form_state['redirect'] = 'admin/settings/node_gallery/relationship/settings/' . $r->rid;
}
else {
$form_state['redirect'] = 'admin/settings/node_gallery';
}
// Repopulate the cache
node_gallery_get_relationship($r->gallery_type, TRUE);
}