summary_field中的SilverStripe用户友好HTML值

I have a DataObject and GridField which, among other fields, holds a HTMLText datatype field. I wish to display a preview of this in the GridField, stripped from HTML.

Non-ideal solution

private static $summary_fields = array(
    'Title' => 'Title',
    'Content.Summary' => 'Content'
);

Using Content.Summary nicely strips the HTML from the original value. However, the linebreaks are removed as well leaving all lines attached to eachother without a whitespace.

How can I strip HTML, but leave linebreaks intact (still hiding the html
tag)?

To preserve
tags in the summary:

private static $summary_fields = array(
    'Title' => 'Title',
    'ContentSummary' => 'Content'
);

private static $casting = array(
    'ContentSummary' => 'HTMLText'
);

public function getContentSummary() {
    $content = $this->dbObject('Content');
    $value = str_replace('<br>', '__br__', $content->getValue());
    $content->setValue($value);
    return str_replace('__br__', '<br>', $content->Summary());
}