mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 00:48:25 +00:00
adding and to TextHelper::toList #1934
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5177 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
e45062f3ef
commit
624e02374a
1 changed files with 2 additions and 3 deletions
|
@ -212,15 +212,14 @@ class TextHelper extends AppHelper {
|
|||
* @param array $list The list to be joined
|
||||
* @return string
|
||||
*/
|
||||
function toList($list) {
|
||||
function toList($list, $and = 'and') {
|
||||
$r = '';
|
||||
$c = count($list) - 1;
|
||||
|
||||
foreach ($list as $i => $item) {
|
||||
$r .= $item;
|
||||
if ($c > 0 && $i < $c)
|
||||
{
|
||||
$r .= ($i < $c - 1 ? ', ' : ' and ');
|
||||
$r .= ($i < $c - 1 ? ', ' : " {$and} ");
|
||||
}
|
||||
}
|
||||
return $r;
|
||||
|
|
Loading…
Add table
Reference in a new issue