7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » How to add File->Filename to List View of Page/Resources
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 943 Views |
-
How to add File->Filename to List View of Page/Resources

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 -
Re: How to add File->Filename to List View of Page/Resources

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.
-
Re: How to add File->Filename to List View of Page/Resources

28 October 2009 at 5:29am
i love you unclecheese! the first version works like a charm!
| 943 Views | ||
|
Page:
1
|
Go to Top |

