You are here

function total_control_admin_settings_submit in Total Control Admin Dashboard 6.2

Same name and namespace in other branches
  1. 7.2 total_control.admin.inc \total_control_admin_settings_submit()

Submit function for settings page

1 string reference to 'total_control_admin_settings_submit'
total_control_admin_settings in ./total_control.admin.inc
menu callback for settings page

File

./total_control.admin.inc, line 154
total_control.admin.inc

Code

function total_control_admin_settings_submit($form, &$form_state) {
  if ($form_state['values']['total_control_role_panels'][2] == 0) {

    // change it back and tell them why
    $form_state['values']['total_control_role_panels'][2] = 2;
    drupal_set_message(t('You can not delete the pane view for users.  To
      remove it from your dashboard, use the <a href="!panels_interface">Page
      Manager</a>.', array(
      '!panels_interface' => url('admin/build/pages'),
    )));
  }
  if ($form_state['values']['total_control_role_pages'][2] == 0) {

    // change it back and tell them why
    $form_state['values']['total_control_role_pages'][2] = 2;
    drupal_set_message(t('You should not delete the page view for all users,
      use the <a href="!views_interface">Views user interface</a> to disable
      it instead.', array(
      '!views_interface' => url('admin/structure/views'),
    )));
  }
  $panes = variable_get('total_control_type_panes', array());
  $pages = variable_get('total_control_type_pages', array());
  $paneview = views_get_view('control_content_panes');
  $pageview = views_get_view('control_content');
  $types = node_get_types();
  foreach ($types as $machine => $type) {
    if (is_array($form_state['values']['total_control_type_panels'])) {
      if ($form_state['values']['total_control_type_panels'][$machine] === $machine) {
        total_control_add_views_pane_display($paneview, $type->name, $machine);
      }
      else {
        total_control_views_delete_pane_display($machine);
      }
    }
    if (is_array($form_state['values']['total_control_type_pages'])) {
      if ($form_state['values']['total_control_type_pages'][$machine] === $machine) {
        total_control_add_views_page_display($pageview, $type->name, $machine);
      }
      else {
        total_control_views_delete_page_display($machine);
      }
    }
  }
}