Closed (fixed)
Project:
Link
Version:
7.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Sep 2012 at 01:32 UTC
Updated:
22 May 2013 at 14:50 UTC
Jump to comment: Most recent file
I have content with Title field filled in, URL left blank, and formatter set to Title as Link.
Title is displayed linked to main site's URL. No theme overrides.
Any hints why that might be?
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | links.png | 130.19 KB | denix |
| #6 | link-plain-1766150-6.patch | 1.38 KB | benjifisher |
| #4 | link-optional-url.patch | 1.14 KB | ezheidtmann |
Comments
Comment #1
drupalok commentedsame problem here. it always renders as link.
Comment #2
Doneeo commentedI've got the same problem. I think its a bug, it worked onces.
Comment #3
ezheidtmann commentedI'm also having this problem. Will report back when I have a solution.
Comment #4
ezheidtmann commentedThis patch fixed my use case, but I haven't tested the other use cases or the other formatters.
The problem was that url() was interpreting a blank URL combined with 'absolute' => TRUE to mean "give me a link to the front page". In this patch, we only call url() if the link is not blank, and use the magic string <front> to link to the front page.
Comment #5
jcfiala commentedHmm.
It's a good idea for a patch, but the thing is that <front> is being removed because sending <front> through check_plain() results in <front>, which I think we can all agree isn't going to work.
What I've done instead is set the code so it only uses check_plain if the url isn't front!
Comment #6
benjifisher#1891340: Empty url gets replaced with path to home page was marked as a duplicate.
I think this is the commit that fixes the issue: ba31bb0.
I tested, and the committed patch works for me.
I have attached a patch file for reference.
Comment #8
denix commentedIn link 7.x-1.1 the error is still there unfortunately.
Comment #9
benjifisher@denix:
It seems to work on my site. Can you give steps to reproduce?
Comment #10
denix commentedHi, thanks for the prompt reply. In the file attached you can see the situation with 7.x-1.1 version of the link module.
The related links block is a view that render the links added in the content type and is positioned with a context.
In the composition you see, on the left how the links are rendered and in the bottom block is how they are inserted:
- External links is empty but appears as a link to the main website;
- title attribute is never displayed
and something really weird is that the block on the left is the same block, but rendered in edit page. As you can see the & char is rendered correctly!
Best regards and thanks!
Comment #11
benjifisherAs I said, it is working on my site, so I suspect something else is going on.
1. I doubt it makes a difference, but what do you get when you look at the node view page (node/1234 for example)? This would take Views and Context out of the picture.
2. What is the markup that generates your screen shot? Depending on your CSS, the following two snippets might display the same:
<li><a href="http://www.google.com">External links</a></li><li>External links</li>3. What format/rewrite options are you using in Views, or what display options did you choose when configuring the field?
Comment #12
denix commentedHi benjifisher,
thanks again. I have fixed the issue, rendering all the links in a blocks. This solve all the "title" related problems:
- External links is now showing correctly (an improvement maybe to add a span to the label i.e.
<span>YourText</span>, so it is easier to customize via css);- Title attribute is shown correctly.
But now a problem arise with the links themself:
link:
http://portal.unesco.org/en/ev.php-URL_ID=13084&URL_DO=DO_TOPIC&URL_SECT...
become:
Note the number of
&in the url!:(
Comment #13
benjifisherThat's a funny-looking URL. I bet the part after "ev.php" is converted into a query string on the UNESCO site.
It looks as though your URL is being run through
htmlspecialchars()multiple times. (htmlspecialchars()is called fromcheck_plain().) This function replaces&with&. Applying it to&give&amp;. That is a separate issue, so I am going to mark this one fixed again. Please report it in a separate issue (after checking to see if it has already been reported).I agree that an extra
<span>would make formatting easier. Open up a feature request! If you are willing to write a custom module, you can also add a custom formatter, available from both views and the "manage display" tab on the node-edit page:Comment #14
denix commentedAmazing! thank you very much! I will now go to open the other two tickets!