/** * @param PageLayoutView $view * @param array $row * @param string $area * @return array */ protected function getRecords(PageLayoutView $view, array $row, $area) { // The following solution is half lifted from \TYPO3\CMS\Backend\View\PageLayoutView::getContentRecordsPerColumn // and relies on TYPO3 core query parts for enable-clause-, language- and versioning placeholders. All that needs // to be done after this, is filter the array according to moved/deleted placeholders since TYPO3 will not remove // records based on them having remove placeholders. $condition = "AND tx_flux_parent = '" . $row['uid'] . "' AND tx_flux_column = '" . $area . "' "; $condition .= "AND colPos = '" . ContentService::COLPOS_FLUXCONTENT . "' "; $condition .= 1 === $view->tt_contentConfig['showHidden'] ? '' : 'AND hidden = 0 '; $queryParts = $view->makeQueryArray('tt_content', $row['pid'], $condition); $result = $this->getDatabaseConnection()->exec_SELECT_queryArray($queryParts); $rows = $view->getResult($result); $rows = $this->processRecordOverlays($rows, $view); return $rows; }
/** * Collects tt_content data from a single tt_content element * * @param PageLayoutView $parentObject : The paren object that triggered this hook * @param int $colPos : The column position to collect the items for * @param array $row : The current data row for the container item * @param string $showHidden : query String containing enable fields * @param string $deleteClause : query String to check for deleted items * * @return array collected items for the given column */ public function collectItemsForColumn(PageLayoutView $parentObject, &$colPos, &$row, &$showHidden, &$deleteClause) { // Due to the pid being "NOT USED" in makeQueryArray we have to set pidSelect here $originalPidSelect = $parentObject->pidSelect; $helper = Helper::getInstance(); $specificIds = $helper->getSpecificIds($row); $parentObject->pidSelect = 'pid = ' . $row['pid']; if (!$parentObject->tt_contentConfig['languageMode']) { $showLanguage = ' AND (sys_language_uid = -1 OR sys_language_uid=' . $parentObject->tt_contentConfig['sys_language_uid'] . ')'; } else { if ($row['sys_language_uid'] > 0) { $showLanguage = ' AND sys_language_uid=' . $row['sys_language_uid']; } else { $showLanguage = ''; } } if ($helper->getBackendUser()->workspace > 0 && $row['t3ver_wsid'] > 0) { $where = 'AND t3ver_wsid = ' . $row['t3ver_wsid']; } $where .= ' AND colPos = -1 AND tx_gridelements_container IN (' . $row['uid'] . ',' . $specificIds['uid'] . ') AND tx_gridelements_columns=' . $colPos . $showHidden . $deleteClause . $showLanguage; $queryParts = $parentObject->makeQueryArray('tt_content', $row['pid'], $where); // Due to the pid being "NOT USED" in makeQueryArray we have to reset pidSelect here $parentObject->pidSelect = $originalPidSelect; $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); return $parentObject->getResult($result); }
/** * Now the query gets enhanced by the "l18n_parent" pointer. This results in fetching * not only L=0 and L=-1 records but native foreign language records as well. * * This method mainly gets used by grid elements. * * @param string $table Table name * @param integer $id Page id (NOT USED! $this->pidSelect is used instead) * @param string $addWhere Additional part for where clause * @param string $fieldList Field list to select, * for all (for "SELECT [fieldlist] FROM ...") * @return array Returns query array * @todo Define visibility */ public function makeQueryArray($table, $id, $addWhere = '', $fieldList = '*') { if (!$this->validModuleConfig()) { return parent::makeQueryArray($table, $id, $addWhere, $fieldList); } $pattern = '%^ AND colPos = -1 AND tx_gridelements_container IN \\(\\d+(,\\d+)*\\) AND tx_gridelements_columns=\\d+ AND tt_content.deleted=0%ims'; if (preg_match($pattern, $addWhere, $matches)) { return parent::makeQueryArray($table, $id, $matches[0] . ' ' . $this->getLanguageRestrictionWhereClause(), $fieldList); } return parent::makeQueryArray($table, $id, $addWhere, $fieldList); }