function system_site_information_settings_validate

Validates the submitted site-information form.

1 string reference to 'system_site_information_settings_validate'
system_site_information_settings in drupal/core/modules/system/system.admin.inc
Form builder; The general site information form.

File

drupal/core/modules/system/system.admin.inc, line 1452
Admin page callbacks for the system module.

Code

function system_site_information_settings_validate($form, &$form_state) {

  // Check for empty front page path.
  if (empty($form_state['values']['site_frontpage'])) {

    // Set to default "user".
    form_set_value($form['front_page']['site_frontpage'], 'user', $form_state);
  }
  else {

    // Get the normal path of the front page.
    form_set_value($form['front_page']['site_frontpage'], drupal_container()
      ->get('path.alias_manager')
      ->getSystemPath($form_state['values']['site_frontpage']), $form_state);
  }

  // Validate front page path.
  if (!drupal_valid_path($form_state['values']['site_frontpage'])) {
    form_set_error('site_frontpage', t("The path '%path' is either invalid or you do not have access to it.", array(
      '%path' => $form_state['values']['site_frontpage'],
    )));
  }

  // Get the normal paths of both error pages.
  if (!empty($form_state['values']['site_403'])) {
    form_set_value($form['error_page']['site_403'], drupal_container()
      ->get('path.alias_manager')
      ->getSystemPath($form_state['values']['site_403']), $form_state);
  }
  if (!empty($form_state['values']['site_404'])) {
    form_set_value($form['error_page']['site_404'], drupal_container()
      ->get('path.alias_manager')
      ->getSystemPath($form_state['values']['site_404']), $form_state);
  }

  // Validate 403 error path.
  if (!empty($form_state['values']['site_403']) && !drupal_valid_path($form_state['values']['site_403'])) {
    form_set_error('site_403', t("The path '%path' is either invalid or you do not have access to it.", array(
      '%path' => $form_state['values']['site_403'],
    )));
  }

  // Validate 404 error path.
  if (!empty($form_state['values']['site_404']) && !drupal_valid_path($form_state['values']['site_404'])) {
    form_set_error('site_404', t("The path '%path' is either invalid or you do not have access to it.", array(
      '%path' => $form_state['values']['site_404'],
    )));
  }
}