/** * Initializes the Categorytree * * @return void */ public function init() { parent::init(); // Create the category leaf /** * Category leaf * * @var Tx_Commerce_Tree_Leaf_Category $categoryLeaf */ $categoryLeaf = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_Category'); // Instantiate the categorydata, -view and set // the permission mask (or the string rep.) /** * Category data * * @var Tx_Commerce_Tree_Leaf_CategoryData $categorydata */ $categorydata = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_CategoryData'); $categorydata->setPermsMask(Tx_Commerce_Utility_BackendUtility::getPermMask($this->minCategoryPerms)); /** * Category view * * @var Tx_Commerce_ViewHelpers_Browselinks_CategoryView $categoryview */ $categoryview = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_ViewHelpers_Browselinks_CategoryView'); // disable the root onclick if the perms are set to editcontent // - this way we cannot select the root as a parent for any content item $categoryview->noRootOnclick($this->minCategoryPerms == 'editcontent'); // Configure the noOnclick for the leaf if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->noClickList, 'Tx_Commerce_Tree_Leaf_Category')) { $categoryview->noOnclick(); } $categoryLeaf->initBasic($categoryview, $categorydata); $this->addLeaf($categoryLeaf); // Add Product - Productleaf will be added to Categoryleaf /** * Product leaf * * @var Tx_Commerce_Tree_Leaf_Product $productleaf */ $productleaf = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_Product'); /** * Product view * * @var Tx_Commerce_ViewHelpers_Browselinks_ProductView $productview */ $productview = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_ViewHelpers_Browselinks_ProductView'); // Configure the noOnclick for the leaf if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->noClickList, 'Tx_Commerce_Tree_Leaf_Product')) { $productview->noOnclick(); } /** * Product data * * @var Tx_Commerce_Tree_Leaf_ProductData $productData */ $productData = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_ProductData'); $productleaf->initBasic($productview, $productData); $categoryLeaf->addLeaf($productleaf); }
/** * Initializes the Categorytree * * @return void */ public function init() { // Call parent constructor parent::init(); // Create the category leaf /** * Category leaf * * @var Tx_Commerce_Tree_Leaf_Category $categoryLeaf */ $categoryLeaf = GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_Category'); // Instantiate the categorydata, -view and set // the permission mask (or the string rep.) /** * Category data * * @var Tx_Commerce_Tree_Leaf_CategoryData $categorydata */ $categorydata = GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_CategoryData'); $categorydata->setPermsMask(Tx_Commerce_Utility_BackendUtility::getPermMask($this->minCategoryPerms)); /** * Category view * * @var Tx_Commerce_Tree_Leaf_CategoryView $categoryview */ $categoryview = GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_CategoryView'); // disable the root onclick if the perms are set to editcontent // this way we cannot select the root as a parent for any content item $categoryview->noRootOnclick($this->minCategoryPerms == 'editcontent'); // Configure real values if ($this->realValues) { $categoryview->substituteRealValues(); } // Configure the noOnclick for the leaf if (GeneralUtility::inList($this->noClickList, 'Tx_Commerce_Tree_Leaf_Category')) { $categoryview->noOnclick(); } $categoryLeaf->initBasic($categoryview, $categorydata); $this->addLeaf($categoryLeaf); // Add Product and Article Leafs if wanted // - Productleaf will be added to Categoryleaf, // - Articleleaf will be added to Productleaf if (!$this->bare) { /** * Product leaf * * @var Tx_Commerce_Tree_Leaf_Product $productleaf */ $productleaf = GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_Product'); /** * Article leaf * * @var Tx_Commerce_Tree_Leaf_Article $articleleaf */ $articleleaf = GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_Article'); /** * Product view * * @var Tx_Commerce_Tree_Leaf_ProductView $productview */ $productview = GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_ProductView'); // Configure the noOnclick for the leaf if (GeneralUtility::inList($this->noClickList, 'Tx_Commerce_Tree_Leaf_Product')) { $productview->noOnclick(); } // Configure real values if ($this->realValues) { $productview->substituteRealValues(); } /** * Article view * * @var Tx_Commerce_Tree_Leaf_ArticleView $articleview */ $articleview = GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_ArticleView'); // Configure the noOnclick for the leaf if (GeneralUtility::inList($this->noClickList, 'Tx_Commerce_Tree_Leaf_Article')) { $articleview->noOnclick(); } // Configure real values if ($this->realValues) { $articleview->substituteRealValues(); } /** * Product data * * @var Tx_Commerce_Tree_Leaf_ProductData $productData */ $productData = GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_ProductData'); $productleaf->initBasic($productview, $productData); /** * Article data * * @var Tx_Commerce_Tree_Leaf_ArticleData $articleData */ $articleData = GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_ArticleData'); $articleleaf->initBasic($articleview, $articleData); $categoryLeaf->addLeaf($productleaf); // Do not show articles in simple mode. if (!$this->simpleMode) { $productleaf->addLeaf($articleleaf); } } }