mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-30 05:09:06 +02:00
Merge pull request #9138 from caffeineinc/bugfix/9114-context-summary-breaks-with-line-breaks
#9114 - DBText::ContextSummary() cuts line breaks
This commit is contained in:
commit
92881eacb7
@ -194,7 +194,7 @@ class DBText extends DBString
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get raw text value, but XML encode it (as we'll be merging with HTML tags soon)
|
// Get raw text value, but XML encode it (as we'll be merging with HTML tags soon)
|
||||||
$text = nl2br(Convert::raw2xml($this->Plain()));
|
$text = Convert::raw2xml($this->Plain());
|
||||||
$keywords = Convert::raw2xml($keywords);
|
$keywords = Convert::raw2xml($keywords);
|
||||||
|
|
||||||
// Find the search string
|
// Find the search string
|
||||||
@ -239,7 +239,7 @@ class DBText extends DBString
|
|||||||
$summary = $summary . $suffix;
|
$summary = $summary . $suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $summary;
|
return nl2br($summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scaffoldFormField($title = null, $params = null)
|
public function scaffoldFormField($title = null, $params = null)
|
||||||
|
@ -333,6 +333,22 @@ class DBHTMLTextTest extends SapphireTest
|
|||||||
'ate',
|
'ate',
|
||||||
// it should highlight 3 letters or more.
|
// it should highlight 3 letters or more.
|
||||||
'A dog <mark>ate</mark> a cat while looking at a Foobar',
|
'A dog <mark>ate</mark> a cat while looking at a Foobar',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'<p>This is a lot of text before this but really, this is a test sentence</p>
|
||||||
|
<p>with about more stuff after the line break</p>',
|
||||||
|
35,
|
||||||
|
'test',
|
||||||
|
'... really, this is a <mark>test</mark> sentence...'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'<p>This is a lot of text before this but really, this is a test sentence</p>
|
||||||
|
<p>with about more stuff after the line break</p>',
|
||||||
|
50,
|
||||||
|
'with',
|
||||||
|
'... sentence<br />
|
||||||
|
<br />
|
||||||
|
<mark>with</mark> about more stuff...'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user