Hi,
I was wondering if it's possible to display a thumbnail of an image in the list overview in a DataObject managed by ModelAdmin.
I've tried casting it but so far without luck.
Any help is appreciated, cheers.
Geert
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hi,
I was wondering if it's possible to display a thumbnail of an image in the list overview in a DataObject managed by ModelAdmin.
I've tried casting it but so far without luck.
Any help is appreciated, cheers.
Geert
Anyone!?
*bump*
Take a look at this: http://silverstripe.org/general-questions/show/263476?start=0#post263669
simon_w on IRC helped me solve this issue
just add <fieldName>.CMSThumbnail.Tag to $summary_fields and you're set to go.
static $has_one = array(
'TickerImage' => 'Image'
);
static $summary_fields = array(
'TickerImage.CMSThumbnail.Tag'
);
thanks for this post! helped me out!
I just wanted to add to this in case it will help someone else.
Today I was doing something similar I had the following DataObject:
class Competition extends DataObject
{
public static $db = array(
'Name' => 'Varchar(255)',
'Start' => 'SSDatetime',
'End' => 'SSDatetime'
);
public static $summary_fields = array(
'Name',
'Duration'
);
public function Duration()
{
return $this->dbObject('Start')->Full() . ' - ' . $this->dbObject('End')->Full();
}
}
The problem was I would get the following error message when visiting the model admin in the CMS:
Error: "Uncaught Exception: Unable to traverse to related object field [Duration] on [Competition]" at line 2492 of /sapphire/core/model/DataObject.php
Turns out to stop this from happening all you need to do is define the searchable_fields, like so:
public static $searchable_fields = array(
'Name'
);
Hopefully this will help someone else in my situation :)
Thank god for you James! That was driving me crazy - I had got a method call to work in $summary_fields before and I couldn't work out why the hell it wouldn't work this time. Seems like a bug to me so I reported it at http://open.silverstripe.org/ticket/6761
JonoM
It looks like this bug you reported is still not resolved yet... I am using 2.4.7