/** * Renders a cObject form an extbase formatted config * * @param mixed $config * @param array $data * @return string */ public function render($config, $data = array()) { if (!is_array($config)) { return $config; } if ($data) { Tx_PtExtbase_Div::getCobj()->start($data); } return Tx_PtExtbase_Div::getCobj()->cObjGetSingle($config['_typoScriptNodeValue'], Tx_Extbase_Service_TypoScriptService::convertPlainArrayToTypoScriptArray($config)); }
/** * Render the given dataValues with cObj * * @param array $tsConfigValue Array with two values in first level 'renderObj' => 'TEXT|COA|IMAGE|...', 'renderObj.' => array(...) * @return string renderedData */ public static function renderCObjectWithPlainArray($tsConfigValue) { if (!is_array($tsConfigValue) && array_key_exists('cObject', $tsConfigValue)) { return $tsConfigValue; } $tsArray = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService')->convertPlainArrayToTypoScriptArray($tsConfigValue); return Tx_PtExtbase_Div::getCobj()->cObjGetSingle($tsArray['cObject'], $tsArray['cObject.']); }
/** * Build and return whereclause part with TYPO3 enablefields criterias * for all tables which are defined in backendConfig.tables and in TCA * * @param array $typo3Tables * @return string whereclause part with TYPO3 enablefields criterias */ protected function getTypo3SpecialFieldsWhereClause(array $typo3Tables) { $specialFieldsWhereClause = ''; foreach ($typo3Tables as $typo3Table) { if (is_array($GLOBALS['TCA'][$typo3Table])) { $specialFieldsWhereClause .= Tx_PtExtbase_Div::getCobj()->enableFields($typo3Table); } } return $specialFieldsWhereClause; }
/** * Build and return whereClause part with TYPO3 enablefields criterias * for all tables which are defined in backendConfig.tables and in TCA * * @return string whereClause part with TYPO3 enablefields criterias */ protected function getTypo3SpecialFieldsWhereClause() { $typo3Tables = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->backendConfiguration->getDataBackendSettings('tables'), true); $specialFieldsWhereClause = ''; foreach ($typo3Tables as $typo3Table) { list($table, $alias) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(' ', $typo3Table, true); $alias = trim($alias); if (is_array($GLOBALS['TCA'][$table])) { $specialFieldsWhereClauseSnippet = Tx_PtExtbase_Div::getCobj()->enableFields($table); if ($alias) { // Make sure not to replace parts of table names with wrong aliases! So check for ' ' to come before and '.' to come after $specialFieldsWhereClauseSnippet = str_replace(' ' . $table . '.', ' ' . $alias . '.', $specialFieldsWhereClauseSnippet); // Make sure not to replace parts of table names with wrong aliases! So check for '(' to come before and '.' to come after $specialFieldsWhereClauseSnippet = str_replace('(' . $table . '.', '(' . $alias . '.', $specialFieldsWhereClauseSnippet); // Make sure not to replace parts of table names with wrong aliases! So check for ',' to come before and '.' to come after $specialFieldsWhereClauseSnippet = str_replace(',' . $table . '.', ',' . $alias . '.', $specialFieldsWhereClauseSnippet); } $specialFieldsWhereClause .= $specialFieldsWhereClauseSnippet; } } return $specialFieldsWhereClause; }