17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 765 Views |
-
There has to be a way...

11 July 2008 at 8:01am
I have a CurriculumDate object on a ComplexTable field. One of its components is a has_many with KeynoteSpeakers. Users choose any number of keynote speakers from checkboxes in the popup, and it works great.
But on the table, I'd like the list of selected keynote speakers to display in a comma-separated list. I tried $table->setFieldFormatting(array('KeynoteSpeakers' => '$MyCommaFunction')), but it looks like that isn't designed to take functions as variables. When I did $ID, it did give the id of the CurriculumDate, however.
I've tried a number of things. My latest hack is to use fieldCasting to cast the KeynoteSpeakers as Enum, and i've hacked the Enum fieldtype to include a function "toCSVList" that looks like this:
function toCSVList()
{
return implode(', ', $this->enumValues(false));
}not so hot, though, and barely works.
Anything?
-
Re: There has to be a way...

14 July 2008 at 5:31pm
On the object that has the KeynoteSpeakers, create a methiod called getKeynoteSpeakersList
function getKeynoteSpeakersList() {
foreach($this->KeynoteSpeakers() as $item) // etc
return $something;
}This will create a dynamic property - $obj->KeynoteSpeakersList
Which means that you can add KeynoteSpeakersList as a column to your CTF.
-
Re: There has to be a way...

16 July 2008 at 2:28am
Worked first try. I knew there had to be a way! Thanks, Sam!!
| 765 Views | ||
|
Page:
1
|
Go to Top |

