Working : Content : fix loop giving no elements
This commit is contained in:
@@ -102,15 +102,16 @@ class Content extends BaseI18nLoop
|
|||||||
|
|
||||||
if (!is_null($folder) || !is_null($folderDefault)) {
|
if (!is_null($folder) || !is_null($folderDefault)) {
|
||||||
|
|
||||||
$folders = array();
|
$foldersIds = array();
|
||||||
if (!is_null($folder)) {
|
if (!is_array($folder)) {
|
||||||
$folders = array_merge($folders, FolderQuery::create()->filterById($folder, Criteria::IN)->find());
|
$folder = array();
|
||||||
}
|
}
|
||||||
|
if (!is_array($folderDefault)) {
|
||||||
if (!is_null($folderDefault)) {
|
$folderDefault = array();
|
||||||
$folders = array_merge(FolderQuery::create()->filterById($folderDefault, Criteria::IN)->find());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$foldersIds = array_merge($foldersIds, $folder, $folderDefault);
|
||||||
|
$folders =FolderQuery::create()->filterById($foldersIds, Criteria::IN)->find();
|
||||||
|
|
||||||
$depth = $this->getDepth();
|
$depth = $this->getDepth();
|
||||||
|
|
||||||
@@ -175,12 +176,12 @@ class Content extends BaseI18nLoop
|
|||||||
$search->addDescendingOrderByColumn('i18n_TITLE');
|
$search->addDescendingOrderByColumn('i18n_TITLE');
|
||||||
break;
|
break;
|
||||||
case "manual":
|
case "manual":
|
||||||
if(null === $folder || count($folder) != 1)
|
if(null === $foldersIds || count($foldersIds) != 1)
|
||||||
throw new \InvalidArgumentException('Manual order cannot be set without single folder argument');
|
throw new \InvalidArgumentException('Manual order cannot be set without single folder argument');
|
||||||
$search->orderByPosition(Criteria::ASC);
|
$search->orderByPosition(Criteria::ASC);
|
||||||
break;
|
break;
|
||||||
case "manual_reverse":
|
case "manual_reverse":
|
||||||
if(null === $folder || count($folder) != 1)
|
if(null === $foldersIds || count($foldersIds) != 1)
|
||||||
throw new \InvalidArgumentException('Manual order cannot be set without single folder argument');
|
throw new \InvalidArgumentException('Manual order cannot be set without single folder argument');
|
||||||
$search->orderByPosition(Criteria::DESC);
|
$search->orderByPosition(Criteria::DESC);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user