Skip to main content
Bumped by Community user
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

I'm trying to get my site to use only relative URLs, like in the question drupal.stackexchange.com/questions/105932drupal.stackexchange.com/questions/105932

I'm trying to get my site to use only relative URLs, like in the question drupal.stackexchange.com/questions/105932

I'm trying to get my site to use only relative URLs, like in the question drupal.stackexchange.com/questions/105932

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Tweeted twitter.com/StackDrupal/status/767997656979439616
Bumped by Community user
Moving note that Drupal 8.0.3 and beyond do this by default
Source Link
jhedstrom
  • 5.1k
  • 2
  • 33
  • 37

EDIT 3: It seems like Drupal 8.0.3 and beyond will do this by default:

https://www.drupal.org/node/2650374

But I've changed the code for Drupal 8 to this by getting rid of the deprecated function:

I've made this work by modifying one line of core. I changed the last line of template_preprocess_file_link() in file.module from $variables['link'] = \Drupal::l($link_text, Url::fromUri($url, $options)); to $variables['link'] = $url;. This makes all URLs relative without any noticeable issues. Does anyone know how to achieve this without hacking core? Or, does anyone know what negative effects doing this might cause?

EDIT 3: It seems like Drupal 8.0.3 and beyond will do this by default:

https://www.drupal.org/node/2650374

But I've changed the code for Drupal 8 to this by getting rid of the deprecated function:

I've made this work by modifying one line of core. I changed the last line of template_preprocess_file_link() in file.module from $variables['link'] = \Drupal::l($link_text, Url::fromUri($url, $options)); to $variables['link'] = $url;. This makes all URLs relative without any noticeable issues. Does anyone know how to achieve this without hacking core? Or, does anyone know what negative effects doing this might cause?

EDIT 3: It seems like Drupal 8.0.3 and beyond will do this by default:

https://www.drupal.org/node/2650374

EDIT 3: It seems like Drupal 8.0.3 and beyond will do this by default:

https://www.drupal.org/node/2650374

But I've changed the code for Drupal 8 to this by getting rid of the deprecated function:

I've made this work by modifying one line of core. I changed the last line of template_preprocess_file_link() in file.module from $variables['link'] = \Drupal::l($link_text, Url::fromUri($url, $options)); to $variables['link'] = $url;. This makes all URLs relative without any noticeable issues. Does anyone know how to achieve this without hacking core? Or, does anyone know what negative effects doing this might cause?

added 118 characters in body
Source Link

EDIT 3: It seems like Drupal 8.0.3 and beyond will do this by default:

https://www.drupal.org/node/2650374

EDIT 3: It seems like Drupal 8.0.3 and beyond will do this by default:

https://www.drupal.org/node/2650374

Changed question name, added details
Source Link
Loading
added more info about the error
Source Link
Loading
Source Link
Loading