Download & Extend

Fieldgroup doesn't fully hide when title entered only

Project:Link
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:mrfelton
Status:closed (works as designed)

Issue Summary

My link field is not required and when nothing is entered into it, the 'fieldgroup' background still shows with nothing in it. I have chosen for the label for the link field to be hidden and that is, but the background still somehow hangs around. I think I had this problem in previous versions also.

I know it's the link field because when I enabled the label for display it would be there right with the background with nothing in it.

Comments

#1

Version:6.x-2.2» 6.x-1.x-dev
Category:support request» bug report
Assigned to:Anonymous» mrfelton

I'm not sure if this is the exact problem described, but in my attempt to recreate this problem I did come across this:

1) create content_type with an optional link filed
2) create a fieldgroup
3) add the link field to the fieldgroup
4) create a node, but do not enter a link
5) view the node - the fieldgroup does not display (as you would expect, but contrary to the original bug report)
6) change the fields display type to 'Separate Title and URL'
7) view the node again - this time, the fieldgroup shows, with the title set to the name of the field, but with no link

Clearly, this field/fieldgroup should not display at all in this situation since no link has been entered in the first placce - and for every other display type, if there is no link, nothing displays.

The attached patch fixes the issue.

AttachmentSize
link.fieldgroup.patch 1.19 KB

#2

Status:active» needs review

#3

Confirming your patch works great here -- thanks!

#4

Status:needs review» reviewed & tested by the community

Confirming that patch worked. thanks! Seem like its RTBC

#5

Possibly related to #336426: empty links stored in db? The underlying problem may be that empty elements are saved in the first place (just a guess).

#6

Version:6.x-1.x-dev» 6.x-2.x-dev
Status:reviewed & tested by the community» needs review

I re-rolled the patch in comment #1 to work against the 6.x-2.x-dev branch.

#7

And the patch...

AttachmentSize
275724-link_prevent_output_empty_links.patch 1.2 KB

#8

The patch in comment #7 didn't work for me with the latest dev. It looks like theme-related functions were moved from 'link.module' to 'link.theme.inc'. Even when I modified the patch to use the new file, it seems the function that was being modified ('theme_link_formatter_separate($element)') wasn't being called, thus link titles were still being shown even when an URL was not set.

Anyway, I've attached a patch that modifies 'theme_link_formatter_default($element)' to return an empty string rather than the title if the URL is empty.

Maybe this could be made into a per-field configuration option... e.g., "If no URL specified, do not output title."

AttachmentSize
275724-link_prevent_output_empty_links-2.patch 571 bytes

#9

I am using #8 and it solved the problem for me.

#10

Status:needs review» closed (fixed)

as far as I know this is fixed. Correct me if I am wrong. But since then I close this issue.

#11

Status:closed (fixed)» needs work

I don't see anything that's been committed to 6.x-2.x-dev that would have fixed this issue... I don't think the patch I posted in #8 is the best solution, but it has been working for me.

#12

Status:needs work» closed (fixed)

fivefrank, your patch is not the solution since it is your use-case only and suppresses a provided feature of link to show title even if no url is given. The others have confirmed that the patch works on their old 6.x version.

Please open a new issue for this to prevent confusion of new followers by the old patches. If you would provide another patch in the new issue, I would be very thankful since I mostly had no sleep last days to catch up for 60 issues here.

Thanks for understandnig

#13

Title:Field doesn't fully hide when nothing entered in it» Fieldgroup doesn't fully hide when title entered only
Status:closed (fixed)» closed (works as designed)

And after reading it again and thinking about it twice, to be honest, I don't think that we will commit that finally, since it works as designed if "the title shows even if no url is given" is the issue here. This is meant to be a feature. So if you are willing to provide a patch for individual use cases in a new issue for latest dev it would be surely much appreciated from users who need it that way.

#14

Fair enough. Created issue# 1319226 to keep track of this feature request.

nobody click here