protected function QPList::listImpl in QueryPath 6
Same name and namespace in other branches
- 7.3 QueryPath/Extension/QPList.php \QPList::listImpl()
- 7.2 QueryPath/Extension/QPList.php \QPList::listImpl()
1 call to QPList::listImpl()
- QPList::appendList in QueryPath/
Extension/ QPList.php
File
- QueryPath/
Extension/ QPList.php, line 78
Class
Code
protected function listImpl($items, $type, $opts, $q = NULL) {
$ele = '<' . $type . '/>';
if (!isset($q)) {
$q = qp()
->append($ele)
->addClass($opts['list class']);
}
foreach ($items as $li) {
if ($li instanceof QueryPath) {
$q = $this
->listImpl($li
->get(), $type, $opts, $q);
}
elseif (is_array($li) || $li instanceof Traversable) {
$q
->append('<li><ul/></li>')
->find('li:last > ul');
$q = $this
->listImpl($li, $type, $opts, $q);
$q
->parent();
}
else {
$q
->append('<li>' . $li . '</li>');
}
}
return $q;
}