Closed (fixed)
Project:
Fullname field for CCK
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
11 Jul 2007 at 22:28 UTC
Updated:
15 Oct 2007 at 22:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
mikey_p commentedOn further review...perhaps there should be a view option for
'First Middle Last' (Will default to 'First Last' when middle is not present or disabled)
'Last, First Middle' (Will default to 'Last, First' when middle is not present or disabled)
'First'
'Last'
Any other formats that should be included? Or should this all be done with themeing?
Comment #2
mikey_p commentedActually, formatting it as "Last, First Middle" would require a different theme function to do most optimally, however it would seem to be nice to be able to do this as a per view option.
Comment #3
mikey_p commentedHrm, so I don't know if this is a views or cck issue, but formatters are not exposed as sort criteria to views. Only the default, provided in hook_field, op 'view' is sortable in the sort criteria area.
One way to get around this would be to make an option in the field settings to choose the default formatter. This won't really affect everyday use of the field, because I *believe* that everywhere it is displayed there exists the option to choose the desired formatter. (such as the display tab under edit for each content type, or the fields section of a view)
By setting the default formatter to 'last name only', or 'last, first middle', there exists that the ability to select which is used for sort criteria in views. However this is rather kludgy, since it requires changing what would appear to be a totally unrelated setting to get the desired effect.
Comment #4
mikey_p commentedHere's a patch that adds 'Last, first middle' as a format, and adds a parameter to be passed to the theme function to tell it how to render that
Comment #5
rconstantine commentedCool. I'll review this the first chance I get!
Two messages ago you asked:
I read somewhere that it is a CCK issue because the author(s) didn't account for modules like cck_address and cck_fullname where multiple fields are rolled into one. Does your patch change the default formatter as you suggested? Or was that an exercise to do at a later time? As I recall, that won't actually change the sort field. What the view sorts is the first entry in the
of the hook_field_settings function. [this code was taken from the text.module] You'll notice that all of the 'standard' cck modules label the first item as 'value'. This is what is expected to be the sortable part. It is my understanding that although the first item doesn't require the label to actually be 'value', that it is still the only one used for sorting in views.
Comment #6
rconstantine commentedSo I quickly took a look at your patch in my browser and it all looks fine to me. Like I said, I think this will only change the display and not the sort field. I think either I opened an issue over at CCK at some point a couple of months ago, or I commented on an existing one. Feel free to tackle that issue over there. I'm in the middle of a 'handshake' module and the final touches on the new 'og_forum' module, so can't look more into cck myself at the moment.
Comment #7
mikey_p commentedThanks for taking a look at this, obviously I didn't get to changing the default part, and I guess it's as good that I didn't because I don't really understand CCK/Views internals all that well. I very briefly chatted about this with merlin the other day, and he seemed to think it was a CCK issue, and I think I see why now, thanks to your follow up.
Comment #8
rconstantine commentedDid you get this to work? I'm having trouble with this. When I produce a view that uses one fullname field for the field, shown as a table or list via a page view (paginated or not), limit set to either 10 or 0, I get a bunch of empty entries followed by the actual expected results. I'm using the latest official views and cck releases.
I see that there is a 'filter' section of the cck_fullname_field_settings function. Perhaps something needs to be added there?
This: http://drupal.org/node/106716 is the best documentation I can find. I'm not seeing any other modules I have that are helping me figure this part out. Is it even needed?
Comment #9
rconstantine commentedAttached is a patch with both your and my changes. Try and see if you can get it to work.
Comment #10
rconstantine commentedAre you interested or not?
Comment #11
rconstantine commentedGuess not, but I added the change anyway. Was included in the last release.