You are here

function onlyone_admin_settings_submit in Allow a content type only once (Only One) 7

Submit handler for the custom form.

1 string reference to 'onlyone_admin_settings_submit'
onlyone_admin_settings in ./onlyone.admin.inc
Form constructor for Only One Settings form.

File

./onlyone.admin.inc, line 143
Calls results to administration's pages for the Only One module.

Code

function onlyone_admin_settings_submit($form, &$form_state) {

  // Getting the value from the form.
  $new_menu_entry_checked = $form_state['values']['onlyone_new_menu_entry'];

  // Getting the onlyone_new_menu_entry variable.
  $onlyone_new_menu_entry = variable_get('onlyone_new_menu_entry');

  // Checking if we have or not changes in the form.
  if ($new_menu_entry_checked == $onlyone_new_menu_entry) {
    drupal_set_message(t("You don't have changes in the form."), 'warning');
  }
  else {

    // Setting the variable.
    variable_set('onlyone_new_menu_entry', $new_menu_entry_checked);

    // Printing the confirmation message.
    drupal_set_message(t('The configuration options have been saved.'));

    // Rebuilding the menu.
    menu_rebuild();
  }
}