diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index a5a8885..e919a05 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1475,20 +1475,39 @@ function system_site_information_settings() { '#type' => 'fieldset', '#title' => t('Front page'), ); + $form['front_page']['default_frontpage'] = array( + '#type' => 'checkbox', + '#title' => t('Use default front page'), + '#default_value' => variable_get('default_frontpage', 1), + '#description' => t('The default front page displays a list of posts with the "promoted to front page" publishing option. Posts are sorted chronologically from newest to oldest.'), + ); $form['front_page']['site_frontpage'] = array( '#type' => 'textfield', - '#title' => t('Default front page'), + '#title' => t('Front page'), '#default_value' => (variable_get('site_frontpage')!='node'?drupal_get_path_alias(variable_get('site_frontpage', 'node')):''), '#size' => 40, - '#description' => t('Optionally, specify a relative URL to display as the front page. Leave blank to display the default content feed.'), + '#description' => t('Specify a relative URL to display as the front page.'), '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), + '#states' => array( + 'invisible' => array ( + ':input[name="default_frontpage"]' => array( + 'checked' => TRUE + ) + ) + ), ); $form['front_page']['default_nodes_main'] = array( '#type' => 'select', '#title' => t('Number of posts on front page'), '#default_value' => variable_get('default_nodes_main', 10), '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), - '#description' => t('The maximum number of posts displayed on overview pages such as the front page.'), - '#access' => (variable_get('site_frontpage')=='node'), + '#description' => t('The maximum number of posts displayed on the front page.'), + '#states' => array( + 'invisible' => array ( + ':input[name="default_frontpage"]' => array( + 'checked' => FALSE + ) + ) + ), ); $form['error_page'] = array( '#type' => 'fieldset', @@ -1524,11 +1543,15 @@ function system_site_information_settings_validate($form, &$form_state) { if ($error = user_validate_mail($form_state['values']['site_mail'])) { form_set_error('site_mail', $error); } - // Check for empty front page path. - if (empty($form_state['values']['site_frontpage'])) { + // Check if default frontpage is being used. + if ($form_state['values']['default_frontpage'] == 1) { // Set to default "node". form_set_value($form['front_page']['site_frontpage'], 'node', $form_state); } + // Check for empty front page path if a custom frontpage is being used. + elseif ($form_state['values']['default_frontpage'] == 0 && empty($form_state['values']['site_frontpage'])) { + form_set_error('site_frontpage', t("The custom frontpage path is blank.")); + } else { // Get the normal path of the front page. form_set_value($form['front_page']['site_frontpage'], drupal_get_normal_path($form_state['values']['site_frontpage']), $form_state);