Fix generating snippet text if the teaser text is shorter than the minimal length
This commit is contained in:
parent
81b16772d7
commit
27f66b40bd
|
@ -43,6 +43,8 @@ class TextSnippet extends Modifier
|
||||||
$value = $text;
|
$value = $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$lengthMin = strlen($value) < $lengthMin ? strlen($value) : $lengthMin;
|
||||||
|
|
||||||
$firstSentenceEnd = strpos($value, '.', $lengthMin);
|
$firstSentenceEnd = strpos($value, '.', $lengthMin);
|
||||||
if ($firstSentenceEnd <= $lengthMax) {
|
if ($firstSentenceEnd <= $lengthMax) {
|
||||||
return substr($value, 0, $firstSentenceEnd + 1);
|
return substr($value, 0, $firstSentenceEnd + 1);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user