/** * ItemProcFunc for columns items * * @param array $params : An array containing the items and parameters for the list of items * * @return void */ public function columnsItemsProcFunc(&$params) { $this->init($params['row']['pid']); $gridContainerId = (int) $params['row']['tx_gridelements_container']; if ($gridContainerId > 0) { $gridElement = $this->layoutSetup->cacheCurrentParent($gridContainerId, TRUE); $params['items'] = $this->layoutSetup->getLayoutColumnsSelectItems($gridElement['tx_gridelements_backend_layout']); if ($params['row']['CType'] !== '' && is_array($params['items'])) { foreach ($params['items'] as $itemKey => $itemArray) { if ($itemArray[3] !== '' && $itemArray[3] !== '*' && !GeneralUtility::inList($itemArray[3], $params['row']['CType'])) { unset($params['items'][$itemKey]); } } } } }
/** * Checks if a CType is allowed in this particular page or grid column - only this one column defines the allowed CTypes regardless of any parent column * * @param array $items : The items of the current CType list * @param integer $pid : The id of the page we are currhently working on * @param integer $pageColumn : The page column the element is a child of * @param integer $gridContainerId : The ID of the current container * @param integer $gridColumn : The grid column the element is a child of * * @return array|null $backendLayout: An array containing the data of the selected backend layout as well as a parsed version of the layout configuration */ public function checkForAllowedCTypes(&$items, $pid, $pageColumn, $gridContainerId, $gridColumn) { if ((int) $pageColumn >= 0 || (int) $pageColumn === -2) { $column = $pageColumn ? $pageColumn : 0; $backendLayout = $this->getSelectedBackendLayout($pid); } else { $this->init($pid); $column = $gridColumn ? $gridColumn : 0; $gridElement = $this->layoutSetup->cacheCurrentParent($gridContainerId, TRUE); $backendLayout = $this->layoutSetup->getLayoutSetup($gridElement['tx_gridelements_backend_layout']); } if (isset($backendLayout)) { foreach ($items as $key => $item) { if (!(GeneralUtility::inList($backendLayout['columns'][$column], $item[1]) || GeneralUtility::inList($backendLayout['columns'][$column], '*'))) { unset($items[$key]); } } } }