public function columns($itemType = 'Pages')
    {
        $columns = [
            'Title' => [
                'title' => _t(__CLASS__ . '.Name', 'Name'),
                'link' => true,
            ],
            'Created' => [
                'title' => _t(__CLASS__ . '.Created', 'Date created'),
                'formatting' => function ($value, $item) {
                    return $item->dbObject('Created')->Nice();
                },
            ],
            'LastEdited' => [
                'title' => _t(__CLASS__ . '.LastEdited', 'Date last edited'),
                'formatting' => function ($value, $item) {
                    return $item->dbObject('LastEdited')->Nice();
                },
            ],
        ];

        if ($itemType === 'Pages') {
            // Page specific fields
            $columns['i18n_singular_name'] = _t(__CLASS__ . '.PageType', 'Page type');
            $columns['StageState'] = [
                'title' => _t(__CLASS__ . '.Stage', 'Stage'),
                'formatting' => function ($value, $item) {
                    // Stage only
                    if (!$item->isPublished()) {
                        return _t(__CLASS__ . '.Draft', 'Draft');
                    }

                    // Pending changes
                    if ($item->isModifiedOnDraft()) {
                        return _t(__CLASS__ . '.PublishedWithChanges', 'Published (with changes)');
                    }

                    // If on live and unmodified
                    return _t(__CLASS__ . '.Published', 'Published');
                },
            ];
            $columns['RelativeLink'] = _t(__CLASS__ . '.Link', 'Link');
            $columns['MetaDescription'] = [
                'title' => _t(__CLASS__ . '.MetaDescription', 'Description'),
                'printonly' => true,
            ];
        } else {
            // File specific fields
            $columns['FileType'] = [
                'title' => _t(__CLASS__ . '.FileType', 'File type'),
                'datasource' => function ($record) {
                    // Handle folders separately
                    if ($record instanceof Folder) {
                        return $record->i18n_singular_name();
                    }

                    return $record->getFileType();
                }
            ];
            $columns['Size'] = _t(__CLASS__ . '.Size', 'Size');
            $columns['Filename'] = _t(__CLASS__ . '.Directory', 'Directory');
        }

        $this->extend('updateColumns', $itemType, $columns);

        return $columns;
    }
public function columns($itemType = 'Pages')
    {
        $columns = [
            'Title' => [
                'title' => _t(__CLASS__ . '.Name', 'Name'),
                'link' => true,
            ],
            'Created' => [
                'title' => _t(__CLASS__ . '.Created', 'Date created'),
                'formatting' => function ($value, $item) {
                    return $item->dbObject('Created')->Nice();
                },
            ],
            'LastEdited' => [
                'title' => _t(__CLASS__ . '.LastEdited', 'Date last edited'),
                'formatting' => function ($value, $item) {
                    return $item->dbObject('LastEdited')->Nice();
                },
            ],
        ];

        if ($itemType === 'Pages') {
            // Page specific fields
            $columns['i18n_singular_name'] = _t(__CLASS__ . '.PageType', 'Page type');
            $columns['StageState'] = [
                'title' => _t(__CLASS__ . '.Stage', 'Stage'),
                'formatting' => function ($value, $item) {
                    // Stage only
                    if (!$item->isPublished()) {
                        return _t(__CLASS__ . '.Draft', 'Draft');
                    }

                    // Pending changes
                    if ($item->isModifiedOnDraft()) {
                        return _t(__CLASS__ . '.PublishedWithChanges', 'Published (with changes)');
                    }

                    // If on live and unmodified
                    return _t(__CLASS__ . '.Published', 'Published');
                },
            ];
            $columns['RelativeLink'] = _t(__CLASS__ . '.Link', 'Link');
            $columns['MetaDescription'] = [
                'title' => _t(__CLASS__ . '.MetaDescription', 'Description'),
                'printonly' => true,
            ];
        } else {
            // File specific fields
            $columns['FileType'] = [
                'title' => _t(__CLASS__ . '.FileType', 'File type'),
                'datasource' => function ($record) {
                    // Handle folders separately
                    if ($record instanceof Folder) {
                        return $record->i18n_singular_name();
                    }

                    return $record->getFileType();
                }
            ];
            $columns['Size'] = _t(__CLASS__ . '.Size', 'Size');
            $columns['Filename'] = _t(__CLASS__ . '.Directory', 'Directory');
        }

        $this->extend('updateColumns', $itemType, $columns);

        return $columns;
    }
public function columns ( $ itemType = 'Pages' ) { $ columns = [ 'Title' => [ 'title' => _t ( __CLASS__ . '.Name' , 'Name' ) , 'link' => true , ] , 'Created' => [ 'title' => _t ( __CLASS__ . '.Created' , 'Date created' ) , 'formatting' => function ( $ value , $ item ) { return $ item -> dbObject ( 'Created' ) -> Nice ( ) ; } , ] , 'LastEdited' => [ 'title' => _t ( __CLASS__ . '.LastEdited' , 'Date last edited' ) , 'formatting' => function ( $ value , $ item ) { return $ item -> dbObject ( 'LastEdited' ) -> Nice ( ) ; } , ] , ] ; if ( $ itemType === 'Pages' ) { // Page specific fields $ columns [ 'i18n_singular_name' ] = _t ( __CLASS__ . '.PageType' , 'Page type' ) ; $ columns [ 'StageState' ] = [ 'title' => _t ( __CLASS__ . '.Stage' , 'Stage' ) , 'formatting' => function ( $ value , $ item ) { // Stage only if ( ! $ item -> isPublished ( ) ) { return _t ( __CLASS__ . '.Draft' , 'Draft' ) ; } // Pending changes if ( $ item -> isModifiedOnDraft ( ) ) { return _t ( __CLASS__ . '.PublishedWithChanges' , 'Published (with changes)' ) ; } // If on live and unmodified return _t ( __CLASS__ . '.Published' , 'Published' ) ; } , ] ; $ columns [ 'RelativeLink' ] = _t ( __CLASS__ . '.Link' , 'Link' ) ; $ columns [ 'MetaDescription' ] = [ 'title' => _t ( __CLASS__ . '.MetaDescription' , 'Description' ) , 'printonly' => true , ] ; } else { // File specific fields $ columns [ 'FileType' ] = [ 'title' => _t ( __CLASS__ . '.FileType' , 'File type' ) , 'datasource' => function ( $ record ) { // Handle folders separately if ( $ record instanceof Folder ) { return $ record -> i18n_singular_name ( ) ; } return $ record -> getFileType ( ) ; } ] ; $ columns [ 'Size' ] = _t ( __CLASS__ . '.Size' , 'Size' ) ; $ columns [ 'Filename' ] = _t ( __CLASS__ . '.Directory' , 'Directory' ) ; } $ this -> extend ( 'updateColumns' , $ itemType , $ columns ) ; return $ columns ; }
Returns columns for the grid fields on this report.

@param string $itemType (i.e 'Pages' or 'Files')

@return array
Returns columns for the grid fields on this report .