first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace KupShop\CatalogBundle\View\Wrapper;
|
||||
|
||||
use KupShop\KupShopBundle\Template\ObjectWrapper;
|
||||
|
||||
class FilterParamsWrapper extends ObjectWrapper
|
||||
{
|
||||
/** @var \FilterParams */
|
||||
protected $object;
|
||||
|
||||
protected static $objectType = \FilterParams::class;
|
||||
|
||||
public function isSelectedSectionByLevel(
|
||||
?int $ancestorID = null,
|
||||
int $level,
|
||||
?int $sectionIDToCheck = null,
|
||||
) {
|
||||
$sectionsByLevel = $this->object->getSectionsByLevel();
|
||||
$sections = isset($sectionsByLevel[$ancestorID][$level]) ? $sectionsByLevel[$ancestorID][$level] : [];
|
||||
|
||||
return is_null($sectionIDToCheck) && count($sections) == 0 || in_array($sectionIDToCheck, $sections);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user