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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

ModelAdmin - how to decorate ?

Go to End

2 Posts   1222 Views


Community Member, 178 Posts

29 January 2011 at 5:16pm

Edited: 29/01/2011 5:25pm

I am decorating a couple classes. These classes are ModelAdmin managed_models.
I would like to have model admin use some of my data additions for Search and Result columns.
How can I decorate the manager of my class?

OK, I have partially found my answer. That is that ModelAdmin is using the $summary_fields and $searchable_fields from my root class to determine this behaviour. SO how do I decorate these features?


Community Member, 178 Posts

29 January 2011 at 6:07pm

ok, heres what I found works.
First we add to the database a language field, then we add it to the searchable_fields static array (this allows model admin to add it to the left side search options), the next function add the same item to the summary_fields static array so that it will be listed in the model admin results table.

    function extraStatics() {
        return array(
            'db' => array(
                'Language' => 'Enum("English,French","English")',
            'searchable_fields' => array(

    function updateSummaryFields(Fieldset &$fields) {
       $fields['Language'] = 'Language'; 

Don't for get to updateCMSFields if you want to have the db value editable in modeladmin.