/** * initialize category related vars and add subcategories to the category selection * * @return void */ function initCategoryVars() { $storagePid = FALSE; if ($this->confArr['useStoragePid']) { $sParr = $this->tsfe->getStorageSiterootPids(); $storagePid = $sParr['_STORAGE_PID']; } $lc = $this->conf['displayCatMenu.']; if ($this->theCode == 'CATMENU') { // init catPidList $catPl = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'pages', 's_misc'); $catPl = $catPl ? $catPl : $this->cObj->stdWrap($lc['catPidList'], $lc['catPidList.']); $catPl = implode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $catPl)); $recursive = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'recursive', 's_misc'); if (!strcmp($recursive, '') || $recursive === NULL) { $recursive = $this->cObj->stdWrap($lc['recursive'], $lc['recursive.']); } if ($catPl) { $storagePid = $this->pi_getPidList($catPl, $recursive); } } if ($storagePid) { $this->SPaddWhere = ' AND tt_news_cat.pid IN (' . $storagePid . ')'; } if ($this->conf['catExcludeList']) { $this->SPaddWhere .= ' AND tt_news_cat.uid NOT IN (' . $this->conf['catExcludeList'] . ')'; } $this->enableCatFields = $this->getEnableFields('tt_news_cat'); $addWhere = $this->SPaddWhere . $this->enableCatFields; $useSubCategories = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'useSubCategories', 'sDEF'); $this->config['useSubCategories'] = strcmp($useSubCategories, '') ? $useSubCategories : $this->conf['useSubCategories']; // global ordering for categories, Can be overwritten later by catOrderBy for a certain content element $catOrderBy = trim($this->conf['catOrderBy']); $this->config['catOrderBy'] = $catOrderBy ? $catOrderBy : 'sorting'; // categoryModes are: 0=display all categories, 1=display selected categories, -1=display deselected categories $categoryMode = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'categoryMode', 'sDEF'); $this->config['categoryMode'] = $categoryMode ? $categoryMode : intval($this->conf['categoryMode']); // catselection holds only the uids of the categories selected by GETvars if ($this->piVars['cat']) { // catselection holds only the uids of the categories selected by GETvars $this->config['catSelection'] = $this->hObj->checkRecords($this->piVars['cat']); $this->piVars_catSelection = $this->config['catSelection']; if ($this->config['useSubCategories'] && $this->config['catSelection']) { // get subcategories for selection from getVars $subcats = tx_ttnews_div::getSubCategories($this->config['catSelection'], $addWhere); $this->config['catSelection'] = implode(',', array_unique(explode(',', $this->config['catSelection'] . ($subcats ? ',' . $subcats : '')))); } } $catExclusive = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'categorySelection', 'sDEF'); $catExclusive = $catExclusive ? $catExclusive : trim($this->cObj->stdWrap($this->conf['categorySelection'], $this->conf['categorySelection.'])); $this->catExclusive = $this->config['categoryMode'] ? $catExclusive : 0; // ignore cat selection if categoryMode isn't set $this->catExclusive = $this->hObj->checkRecords($this->catExclusive); // store the actually selected categories because we need them for the comparison in categoryMode 2 and -2 $this->actuallySelectedCategories = $this->catExclusive; // get subcategories if ($this->config['useSubCategories'] && $this->catExclusive) { $subcats = tx_ttnews_div::getSubCategories($this->catExclusive, $addWhere); $this->catExclusive = implode(',', array_unique(explode(',', $this->catExclusive . ($subcats ? ',' . $subcats : '')))); } // get more category fields from FF or TS $fields = explode(',', 'catImageMode,catTextMode,catImageMaxWidth,catImageMaxHeight,maxCatImages,catTextLength,maxCatTexts'); foreach ($fields as $key) { $value = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], $key, 's_category'); $this->config[$key] = is_numeric($value) ? $value : $this->conf[$key]; } }