/**
  * @param LayerCategoryInterface $category
  * @param Options           $options
  * @param array             $choices
  * @param int               $level
  */
 private function childWalker(LayerCategoryInterface $category, Options $options, array &$choices, $level = 2)
 {
     if ($category->getChildren() === null) {
         return;
     }
     foreach ($category->getChildren() as $child) {
         if ($options['category'] && $options['category']->getId() == $child->getId()) {
             continue;
         }
         $choices[$child->getId()] = sprintf("%s %s", str_repeat('-', 1 * $level), $child);
         $this->childWalker($child, $options, $choices, $level + 1);
     }
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function setParent(LayerCategoryInterface $parent = null, $nested = false)
 {
     $this->parent = $parent;
     if (!$nested && $parent) {
         $parent->addChild($this, true);
     }
 }