Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

How to add File->Filename to List View of Page/Resources


Reply


3 Posts   1243 Views

Avatar
tilluigi

Community Member, 9 Posts

28 October 2009 at 4:51am

I am trying to display the Filename of my FileObject linked to my Page via ResourceObject. In my Page->getCMSFields() I have tried things like:

$manager = new FileDataObjectManager(
   $this,
   'Resources',
   'Resource',
   'Attachment',
   array(
      'Name' => 'Name',
      'Attachment()->Filename' => 'Filename'
   ),
   'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
);

But with no luck. Is there a way to achieve this?

Thanks,
Tilluigi

Avatar
UncleCheese

Forum Moderator, 4096 Posts

28 October 2009 at 5:20am

Try:

array(
'Name' => 'Name',
'Attachment.Filename' => 'Filename'
),

If that doesn't work, define in your 'Resource' class:

function getFilename()
{
return $this->Attachment()->Filename;
}

and then use

array(
'Name' => 'Name',
'Filename' => 'Filename'
),

Also, keep in mind you can use setGridLabelField() in FileDOM to show the filename, too, if you want.

Avatar
tilluigi

Community Member, 9 Posts

28 October 2009 at 5:29am

i love you unclecheese! the first version works like a charm!