Jump to:

3461 Posts in 1065 Topics by 740 members

Data Model Questions

SilverStripe Forums » Data Model Questions » ModelAdmin - how to decorate ?

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

Page: 1
Go to End
Author Topic: 802 Views
  • DsX
    Community Member
    178 Posts

    ModelAdmin - how to decorate ? Link to this post

    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?

  • DsX
    Community Member
    178 Posts

    Re: ModelAdmin - how to decorate ? Link to this post

    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.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.