You are here

function total_control_admin_settings_submit in Total Control Admin Dashboard 7.2

Same name and namespace in other branches
  1. 6.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 171
This module enables a page to be used as an administrative dashboard Also included are several views for site administration.

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/structure/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'),
    )));
  }

  // Load the views once so we don't have to do it each time.
  $paneview = views_get_view('control_content_panes');
  $pageview = views_get_view('control_content');

  // Adjust content pane displays per Total Control settings.
  foreach ($form_state['values']['total_control_type_panels'] as $machine => $value) {
    if ($machine === $value) {
      $type = node_type_load($machine);
      total_control_add_views_pane_display($paneview, $type->name, $machine);
    }
    else {
      $type = node_type_load($machine);
      total_control_views_delete_pane_display($machine);
    }
  }

  // Adjust page displays per Total Control settings.
  foreach ($form_state['values']['total_control_type_pages'] as $machine => $value) {
    if ($machine === $value) {
      $type = node_type_load($machine);
      total_control_add_views_page_display($pageview, $type->name, $machine);
    }
    else {
      $type = node_type_load($machine);
      total_control_views_delete_page_display($machine);
    }
  }
}