For some reason, the phone field does not show up in Views that are tables or lists, but it does show up in other views.

CommentFileSizeAuthor
#16 phonecck.png2.03 KBtknospdr
#4 phone_1.patch1.31 KBTresler
#2 patch_92.txt14.53 KBspecialtouch

Comments

coupet’s picture

confirmed, having same issue

specialtouch’s picture

Status: Active » Needs review
StatusFileSize
new14.53 KB

This latest patch fixes problem. Only works with Drupal 5.

Tresler’s picture

patch_92.txt appears to also completely remove French Phone Number functionality. Just FYI

Tresler’s picture

StatusFileSize
new1.31 KB

Attached is a patch that resolves this issue for 4.7

Replaced hook_field custom function with content_format().
Formatting is still done before database entry - this just makes it play nice with Views.

thierry_gd’s picture

Just applied some changes. cf. new 4.7 release

mshaver’s picture

I'm not getting this to work still? I actually solved the problem before the patch by creating a phptemplate_views_handle_field entry in my template.php file. For some reason this worked? With the patch, now neither works?

Any ideas?

Tresler’s picture

Hey Thierry,
Just getting a chance to look at this. I'll download and test, but just looking at the code, it looks like you're still going around the flow that cck uses.

the content_format() function passes the default formatter to hook_field_formatter. By calling phone_field _formatter() from inside phone_field, you're eliminating the need for this.

I guess a better way to put it is this:

content.module will imvoke hook_field and hook_field_formatter itself. By calling phone_field_formatter in your module you are circumventing the work that content.module should be doing. That, and unles I'm mistaken, phone_field_formatter will now be called respeatedly - once by you and once by content.module.

Testing, and will report back.

Tresler’s picture

Ok, here's the story, this works, but... The formatter system was set up so that if someone wanted to write a different formatter to extend this, they would just need to write a new module - without altering yours (much more applicable to core than contrib, but still, better to not have to alter a module if you can extend it elsewhere.

So if I wanted to, say, format all phone numbers to have a pretty picture beside them, I could create a module called phone-pretty-picture, and all I would need to call inside that module would be a new hook_field_formatter() and hook_field_formatter_info

By, bypassing the content_format() function, content.module doesn't get to give other modules a chance to throw in new formatters.

mshaver’s picture

This is still not working! I don't understand why these particular views (table & list) aren't displaying the values? Any help would be appreciated.

Thanks!

Tresler’s picture

mshaver - yeah - thats what "patch (code needs review)" means. We're working on it.

If you are so inclined to help, download the module, apply the patch and tell us if it works for you. That would be the "review" we are looking for.

I refer you to http://drupal.org/node/28245 for information on applying a patch to a version of drupal. Please note that the patch I submitted is against 4.7 - not head.

Thanks!

mshaver’s picture

Sorry, my follow-up message wasn't clear that it was against your patch and it doesn't seem to work on my installation. I've tried to modify the code to make it show up without luck. I'm stuck at this point.

Has anyone tried the patch against Drupal 5?

Tresler’s picture

I don't think the patch will work against 5.0, although I'm not sure.

The patch I submitted you need to be sure to clear your cache even if you don't have caching enabled (don't ask me why, I don't know, but thats what I had to do).

If that doesn't work, post back and I'll look at it again.

mshaver’s picture

Yes, your patch does work! Thanks for your work. One confusion was the versions seem screwed up, as your patch was against 1.2 right and current 4.7 version is 1.1.5 I believe. Anyway, I'm using the 1.2 version with your patch and it's working. Multiple values stil seems like it's not working though.

Tresler’s picture

Multiple Values Issue

http://drupal.org/node/91068

Tresler’s picture

Hi Thierry,
I've sent two messages to your ontact page, but in the event it isn't working:

I have a decent interest in seeing this and zipcode.module patches that I submitted - committed as I am running them on production sites. I TOTALLY understand if you're busy. Would you be interested in giving me co-maintainership, or passing these along to me?

Just to be clear, I'm not criticizing, just offering my help. Thanks for all your hard work!

--Sam Tresler

tknospdr’s picture

StatusFileSize
new2.03 KB

I'm getting this:

    * user warning: Unknown column 'field_phone_number_value' in 'field list' query: INSERT INTO content_type_content_classified_free (field_phone_number_value, vid, nid) VALUES ('+1 321-961-5281', 39, 38) in /Users/david/Sites/fpo-r5/includes/database.mysql.inc on line 172.
    * user warning: Unknown column 'field_phone_number_value' in 'field list' query: SELECT field_phone_number_value AS value FROM content_type_content_classified_free WHERE vid = 39 in /Users/david/Sites/fpo-r5/includes/database.mysql.inc on line 172.

My guess is it's because you can't choose any value except hidden when you try to insert it into a view. I tried the patch and it didn't work. As a matter of fact I don't think I was getting those errors above until after I tried your new version and it's patch.

See attached screenshot to see what I was taking about RE hidden.

thierry_gd’s picture

Status: Needs review » Fixed

Corrections done in drupal 5 version

tknospdr’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Fixed » Active

I was using the new version. And I just updated to your latest dev version dated this morning and I'm still getting the same issue. I can only choose hidden in the Display Fields section of my defined content types.
Any help appreciated.

Thanks,
David
http://www.FloridaPets.org

thierry_gd’s picture

Status: Active » Fixed

updates done

Anonymous’s picture

Status: Fixed » Closed (fixed)