If I try to set my site frontpage to an alias, I get a message that this is not allowed and that the real path is being stored instead. (Which bothered me because I wanted to set it to an alias for translation purposes). The message is inconsistent with what it actually does about it, which is nothing. Instead of changing anything in the $form_state, it just changes the value of a meaningless variable.

This is not an issue in D7.

/**
 * Validate the submitted site-information form.
 */
function system_site_information_settings_validate($form, &$form_state) {
  // Validate the e-mail address.
  if ($error = user_validate_mail($form_state['values']['site_mail'])) {
    form_set_error('site_mail', $error);
  }
  // Validate front page path.
  $item = array('link_path' => $form_state['values']['site_frontpage']);
  $normal_path = drupal_get_normal_path($item['link_path']);
  if ($item['link_path'] != $normal_path) {
    drupal_set_message(t('The menu system stores system paths only, but will use the URL alias for display. %link_path has been stored as %normal_path', array('%link_path' => $item['link_path'], '%normal_path' => $normal_path)));
    $item['link_path'] = $normal_path;
  }
  if (!empty($item) && !menu_valid_path($item)) {
    form_set_error('site_frontpage', t("The path '@path' is either invalid or you do not have access to it.", array('@path' => $item['link_path'])));
  }
}

Comments

dave reid’s picture

Status: Active » Closed (duplicate)

The message never says it isn't allowed. This is also a duplicate of the backport needed in #613858: drupal_is_front_page() should not call drupal_get_normal_path().

jody lynn’s picture

Status: Closed (duplicate) » Active

Sorry, it doesn't seem the same to me.

The message says "%link_path has been stored as %normal_path" which is not true.
$item['link_path'] = $normal_path;
was probably intended to be
$form_state['values']['site_frontpage'] = $normal_path;

dave reid’s picture

Status: Active » Closed (duplicate)

Yes. Because the issue I linked to actually fixes it in that it actually would save the frontpage as the normal path. Trust me. :)