/** * @param UnicatConfigurationManager $ucm * @param TaxonModel|false $lastTaxon * * @throws \Exception */ protected function buildFrontControlForTaxon(UnicatConfigurationManager $ucm, $lastTaxon = false) { $this->node->addFrontControl('create_item')->setTitle('Добавить запись')->setUri($this->generateUrl('unicat_admin.item_create_in_taxon', ['configuration' => $ucm->getConfiguration()->getName(), 'default_taxon_id' => empty($lastTaxon) ? 0 : $lastTaxon->getId()])); if (!empty($lastTaxon)) { $this->node->addFrontControl('create_taxon')->setIsDefault(false)->setTitle('Создать Taxon')->setUri($this->generateUrl('unicat_admin.structure_with_parent_id', ['configuration' => $ucm->getConfiguration()->getName(), 'parent_id' => empty($lastTaxon) ? 0 : $lastTaxon->getId(), 'id' => $lastTaxon->getStructure()->getId()])); $this->node->addFrontControl('edit_taxon')->setIsDefault(false)->setTitle('Редактировать Taxon')->setUri($this->generateUrl('unicat_admin.taxon', ['configuration' => $ucm->getConfiguration()->getName(), 'id' => $lastTaxon->getId(), 'structure_id' => $lastTaxon->getStructure()->getId()])); } $this->node->addFrontControl('manage_configuration')->setIsDefault(false)->setTitle('Управление каталогом')->setUri($this->generateUrl('unicat_admin.configuration', ['configuration' => $ucm->getConfiguration()->getName()])); }
/** * Рекурсивный обход всех сложенных таксонов. * * @param array $taxonsInherited * @param TaxonModel $taxon */ protected function getTaxonsInherited(&$taxonsInherited, TaxonModel $taxon) { if ($taxon->getParent()) { $this->getTaxonsInherited($taxonsInherited, $taxon->getParent()); } $taxonsInherited[$taxon->getId()] = $taxon; }