Download & Extend

How to know if the title field is empty?

Project:Link
Version:7.x-1.0
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hello,

I'm trying to display link fields, and I need url and title separately.

If the title (optional) isn't filled in, Link module puts the url in place of the title.
But how to know if the title has been filled in or not, from a node template?

I can't find a way to check the real value of the title field.

Any idea?

Thanks!

Comments

#1

Well, I'm not sure if this is a _bug_, actually, but that's a good point. Hm.

What if I returned some sort of 'title_status' field... or entered_title... thoughts?

#2

You know, I think I might try returning an "original_title" and "original_url" fields, so themers can get at the original values if they __really__ want to... But willing to entertain feedback.

#3

Category:bug report» feature request

In fact, I have a link field with optional title.

If the user fills in the title, then we display the title value.
If the user doesn't fill in the title, then we have to display "Read article", and it must be translated (so field's default value doesn't meet requirements).

"original_title" and "original_url" (?), seem to be a decent solution.

#4

I'm thinking of combining this with #1475790: Link should not modify $item['url'] on node_view() (causes data loss when combined with Workbench Moderation), so that would mean actually going to creating new url/title/attribute fields for the themes to hook off of, and leaving the original url/title as is.

However, that's a bit of whiplash for existing theme functions. I'm thinking if I'm doing something this radical to how the field is themed, it should be part of moving to 7.x-2.0 version.