You are here

function front_page_admin_submit in Front Page 7.2

Same name and namespace in other branches
  1. 6.2 front_page.admin.inc \front_page_admin_submit()

Submit hook for front_page_admin.

File

./front_page.admin.inc, line 168
Admin page callbacks for the front page module.

Code

function front_page_admin_submit($form, &$form_state) {
  variable_set('front_page_enable', $form_state['values']['front_page_enable']);
  if (is_array($form_state['values']['roles'])) {
    foreach ($form_state['values']['roles'] as $rid => $role) {
      switch ($role['mode']) {
        case 'themed':
        case 'full':
          $data = _front_page_get_by_rid_with_default($rid);
          $data['mode'] = $role['mode'];
          $data['data'] = $role['data_wrapper']['data']['value'];
          $data['filter_format'] = $role['data_wrapper']['data']['format'];
          variable_set("front_page_role_{$rid}", $data);
          break;
        case 'redirect':
        case 'alias':
          $data = _front_page_get_by_rid_with_default($rid);
          $data['mode'] = $role['mode'];
          $data['data'] = $role['path'];
          $data['filter_format'] = '';
          variable_set("front_page_role_{$rid}", $data);
          break;
        default:
          $data = _front_page_get_by_rid_with_default($rid);
          $data['mode'] = '';
          $data['data'] = '';
          $data['filter_format'] = '';
          variable_set("front_page_role_{$rid}", $data);
          break;
      }
    }
  }
  drupal_set_message(t('Your settings have been saved.'));
}