1
votes

Is it possible to change or add custom summary_fields into a listing from a ModelAdmin extends? Actually I'm able to filter a custom field named Type but I don't know how to customize the summary_fields. This is my actual code:

class Profiles3ModelAdmin extends ModelAdmin {

    public static $menu_icon = 'mysite/images/peoples.png';
    public static $managed_models = array('Member'); 
    public static $url_segment = 'membres'; 
    public static $menu_title = 'Membres';

    public function getList() {

        $group = Group::get()->filter('Code', array('Membres'))->first();
        $list = $group->Members()->filter('Type', 1 );

        return $list;
    }

}
1

1 Answers

2
votes

Your current query should be able to use $list = Member::get()->filter(array('Groups.Code' => 'Membres', 'Type' => 1)); if I recall correctly. Just gets it down to one line.

Usually to add to the summary you would add it to your class's model. So in this case on Member you would apply a DataExtension that had:

<?php
    class MyMemberDataExtension extends DataExtension{
        private static $summary_fields = array(
            'Type'
        );
    }