mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
This is a hotfix for TextHelper which seems to have gone wrong in a merge. tail() is missing completly and the docs for truncate() are the ones for tail(). This fixes it.
This commit is contained in:
parent
6c6a6507d5
commit
fecf321cce
2 changed files with 28 additions and 4 deletions
|
@ -79,7 +79,7 @@ class TextHelperTest extends CakeTestCase {
|
|||
*/
|
||||
public function testTextHelperProxyMethodCalls() {
|
||||
$methods = array(
|
||||
'highlight', 'stripLinks', 'truncate', 'excerpt', 'toList',
|
||||
'highlight', 'stripLinks', 'truncate', 'tail', 'excerpt', 'toList',
|
||||
);
|
||||
$String = $this->getMock('StringMock', $methods);
|
||||
$Text = new TextHelperTestObject($this->View, array('engine' => 'StringMock'));
|
||||
|
|
|
@ -266,6 +266,30 @@ class TextHelper extends AppHelper {
|
|||
return $this->_engine->stripLinks($text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncates text.
|
||||
*
|
||||
* Cuts a string to the length of $length and replaces the last characters
|
||||
* with the ellipsis if the text is longer than length.
|
||||
*
|
||||
* ### Options:
|
||||
*
|
||||
* - `ellipsis` Will be used as Ending and appended to the trimmed string (`ending` is deprecated)
|
||||
* - `exact` If false, $text will not be cut mid-word
|
||||
* - `html` If true, HTML tags would be handled correctly
|
||||
*
|
||||
* @see String::truncate()
|
||||
*
|
||||
* @param string $text String to truncate.
|
||||
* @param integer $length Length of returned string, including ellipsis.
|
||||
* @param array $options An array of html attributes and options.
|
||||
* @return string Trimmed string.
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::truncate
|
||||
*/
|
||||
public function truncate($text, $length = 100, $options = array()) {
|
||||
return $this->_engine->truncate($text, $length, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncates text starting from the end.
|
||||
*
|
||||
|
@ -283,10 +307,10 @@ class TextHelper extends AppHelper {
|
|||
* @param integer $length Length of returned string, including ellipsis.
|
||||
* @param array $options An array of html attributes and options.
|
||||
* @return string Trimmed string.
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::truncate
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::tail
|
||||
*/
|
||||
public function truncate($text, $length = 100, $options = array()) {
|
||||
return $this->_engine->truncate($text, $length, $options);
|
||||
public function tail($text, $length = 100, $options = array()) {
|
||||
return $this->_engine->tail($text, $length, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue