IMPROVEMETS: Enabled grid summary

This commit is contained in:
Tony Air 2019-12-11 09:45:24 +07:00
parent 3c19cd7741
commit 0a3675b460

View File

@ -65,11 +65,14 @@ class WidgetAreaField extends GridField
$config->getComponentByType(GridFieldDataColumns::class)->setDisplayFields([ $config->getComponentByType(GridFieldDataColumns::class)->setDisplayFields([
'Icon' => '', 'Icon' => '',
'Title' => 'Title', 'Title' => 'Title',
'LastEdited' => 'Changed', 'Enabled' => 'Enabled',
])->setFieldFormatting([ ])->setFieldFormatting([
'Icon' => static function($v, Widget $item) { 'Icon' => static function($v, Widget $item) {
return '<span style="font-size:2rem">'.$item::config()->get('icon').'</span>'; return '<span style="font-size:2rem">'.$item::config()->get('icon').'</span>';
} },
'Enabled' => static function($v, Widget $item) {
return $item->getField('Enabled') ? 'Yes' : 'No';
},
]); ]);
$config->addComponent(new GridFieldEditButton()); $config->addComponent(new GridFieldEditButton());