Skip to content

Commit

Permalink
CMS GridField UX improvement
Browse files Browse the repository at this point in the history
Improve user experience showing Block $title in CMS GridField instead of ClassName.
  • Loading branch information
jelicanin authored Dec 18, 2018
1 parent 0a1821d commit e5179b8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Model/ContentBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class ContentBlock extends DataObject implements PermissionProvider

private static $summary_fields = [
'Thumbnail' => '',
'ID' => 'ID',
'ClassName' => 'ClassName',
'ID' => 'ID',
'BlockType' => 'Content type',
'Title' => 'Title',
'Pages.Count' => 'Pages'
];
Expand Down Expand Up @@ -94,6 +94,11 @@ public function getAction()
return array_pop($path);
}

public function getBlockType()
{
return $this->owner->ClassName::config()->get('title');
}

private function getCMSSelectionFields(FieldList $fields)
{
$fields->removeByName('Root');
Expand Down Expand Up @@ -179,4 +184,4 @@ public function canDelete($member = null, $context = [])
{
return Permission::check('DELETE_CONTENT_BLOCKS', 'any', $member);
}
}
}

0 comments on commit e5179b8

Please sign in to comment.