Closed (duplicate)
Project:
Link
Version:
7.x-1.0
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Jun 2011 at 18:17 UTC
Updated:
1 Mar 2012 at 21:32 UTC
All stored links are displayed as http://www.domain.com
What is the best way for a new a newbie like me, to remove http:// from url display?
I would like to show all my links like www.domain.com
Any help woulb be most appreciated :-)
Thanks
Comments
Comment #1
dqdby typing it exactly like that ;)
the module support input converstion, depends on your title / url settings. But please use latest 7.x-1.x--dev of link module from now. It is strongly recommended to use it rather than alpha3, since in latest --dev push are already some of known issues fixed.
Comment #3
AniaMi commentedsubs.
Comment #4
dqd@AniaMi: please follow the new conventions: #1306444
btw: the issue was closed and the solution is sel-explaining by the options in the input area and by the options in manage field dialogs and its link widgets.
Every time when somebody adds a sub or 1+ or whatver I get a message to look for an issue and I don't have time for goose chases.
thanks 4 understanding.
Comment #5
emartin commentedA very dirty solution, but if it can help someone...
In link.module, ligne 475 (on version 7.x-1.0)
- $item['title'] = empty($title) ? $item['display_url'] : $title;
+ $item['title'] = empty($title) ? str_replace('http://', '', $item['display_url']) : $title;
Comment #6
emartin commentedA cleaner solution :
To override the default formatter, add this in your theme's template.php (replace YOURTHEME with your theme's name) :
/**
* Theme function for 'default' text field formatter.
* (Override of theme_link_formatter_link_default($vars) from link.module, line 748)
*/
function YOURTHEME_link_formatter_link_default($vars) {
$link_options = $vars['element'];
unset($link_options['element']['title']);
unset($link_options['element']['url']);
// Issue #1199806 by ss81: Fixes fatal error when the link URl is equal to page URL
if (isset($link_options['attributes']['class'])) {
$link_options['attributes']['class'] = array($link_options['attributes']['class']);
}
//Added code to remove http(s):// from link title
$vars['element']['title'] = !empty($vars['element']['title']) ? preg_replace('/^http(s)?:\/\//i', '', $vars['element']['title']) : $vars['element']['title'];
// Display a normal link if both title and URL are available.
if (!empty($vars['element']['title']) && !empty($vars['element']['url'])) {
return l($vars['element']['title'], $vars['element']['url'], $link_options);
}
// If only a title, display the title.
elseif (!empty($vars['element']['title'])) {
return check_plain($vars['element']['title']);
}
elseif (!empty($vars['element']['url'])) {
return l($vars['element']['title'], $vars['element']['url'], $link_options);
}
}
You can do similar override for the other formatters (following in link.module).
Comment #7
adam_b commentedSorry to re-open this, but I'm using 7.x-1.0 and it always outputs the URL as http://www.domain.com, even when the field only has www.domain.com entered in it.
a. Could this be fixed?
b. Could there be a field-display option to display/hide the "http://" whether or not it's entered in the field? it seems like an obvious requirement, rather than editing the module or template files.
Comment #8
dqdadam_b: At first ... this particular issue _is_ already fixed. Search the issue queue before opening an old issues and _please_ .... read the link module project page. If you have ideas for link URL validation options (and your scenario is one of those thousands), please post them in the issue posted on the project page. (No, I won't post the link here the 10.000st time).
Sorry but I am tired of the same issues again and again and again.
Thanks for understanding.
Comment #9
adam_b commentedDigidog, I have no desire to waste your time but, with respect,:
1. My experience is that this issue is not fixed - this was the only D7 reference I could find to the problem, but I've added a comment at #530884: Option for http://link input to link text without http:// missing
2. I've read the link module page which says:
but this doesn't agree with what you say in #530884: Option for http://link input to link text without http:// missing:
Comment #10
dqdadam_b,
I am sorry, I didn't want to sound barking. I just try to catch up with link module issue queue, but it seems like a story without an end. All I wish is to come to a actual timeline of issues. But as long as everybody throws in here and there what he/she momentary thinks of, we will have tons of dups flying around and loose overview.
The link I spoke about is and which can also be found on the project page is
#1318938: An all-embracing attempt for URL validation and Input / Output Form Filtering
Read this issue carefully and you will understand why this issue here is a duplicate. I will make this link more obvious on the project page now, because I DON'T want to see any filter/validation issue no more arising since this ^ issue is fixed or at least filled with some life. A community module lives from contribution and cooperation.
Comment #11
adam_b commentedI didn't take it personally, and I sympathize with the problem of a never-ending issue queue :)
I can see the relevance of that link now - I think I saw "URL validation" and mentally dismissed it as not what I was looking for. I'll let this closed issue rest in peace and take my comments to other threads.