Browse Source

Utils : limitTextByLength

develop
Guillaume 3 years ago
parent
commit
fae951b10c
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      ShopBundle/Services/Utils.php

+ 9
- 0
ShopBundle/Services/Utils.php View File

@@ -87,6 +87,15 @@ class Utils
return $text;
}

public function limitTextByLength($text, $length)
{
if(strlen($text) > $length) {
$text = substr($text, 0, $length).' ... ' ;
}

return $text ;
}

function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
{
if ($considerHtml) {

Loading…
Cancel
Save