diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2018-12-21 13:31:50 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2018-12-21 13:31:50 +0000 |
| commit | 9a9e551aa818dd395fff089547e1f671b10094dd (patch) | |
| tree | 03bc99971748cb8a96574235b10fa9d142dfa6cb /app/Report/ReportParserGenerate.php | |
| parent | 809fcb312feb2e739b8f6ab124469069a5ba04d9 (diff) | |
| download | webtrees-9a9e551aa818dd395fff089547e1f671b10094dd.tar.gz webtrees-9a9e551aa818dd395fff089547e1f671b10094dd.tar.bz2 webtrees-9a9e551aa818dd395fff089547e1f671b10094dd.zip | |
Use laravel support functions to truncate strings
Diffstat (limited to 'app/Report/ReportParserGenerate.php')
| -rw-r--r-- | app/Report/ReportParserGenerate.php | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php index 136c35328f..73ef7d7b34 100644 --- a/app/Report/ReportParserGenerate.php +++ b/app/Report/ReportParserGenerate.php @@ -34,6 +34,7 @@ use Fisharebest\Webtrees\Media; use Fisharebest\Webtrees\Note; use Fisharebest\Webtrees\Place; use Fisharebest\Webtrees\Tree; +use Illuminate\Support\Str; use stdClass; use Symfony\Component\Cache\Adapter\NullAdapter; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; @@ -942,9 +943,7 @@ class ReportParserGenerate extends ReportParserBase ); $name = strip_tags($name); if (!empty($attrs['truncate'])) { - if (mb_strlen($name) > $attrs['truncate']) { - $name = mb_substr($name, 0, $attrs['truncate'] - 1) . '…'; - } + $name = Str::limit($name, $attrs['truncate'], I18N::translate('…')); } else { $addname = $record->getAddName(); $addname = preg_replace( |
