silverstripe ModelAdmin Control columns displayed for the DataObject

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

class MyDataObject extends DataObject {

    private static $db = array(
        'Name' => 'Varchar'
    );

    private static $has_one = array(
        'OtherDataObject' => 'OtherDataObject'
    );
    
    private static $summary_fields = array(
        'Name',
        'OtherDataObject.Name'
    );
    
    private static $field_labels = array(
        'OtherDataObject.Name' => 'Other Data Object'
    );
}

ModelAdmin uses the summary_fields to generate the columns that it displays. To specify the name of the column, use field_labels as shown.



Got any silverstripe Question?