64 $this->
template = str_repeat(PHP_EOL, 3) .
'CREATE TABLE %s (' . PHP_EOL
65 .
' %s int(11) DEFAULT \'0\' NOT NULL' . PHP_EOL .
');' . str_repeat(PHP_EOL, 3);
85 public function add($extensionKey, $tableName, $fieldName =
'categories', array $options = array()) {
87 if (empty($tableName) || !is_string($tableName)) {
88 throw new \InvalidArgumentException(
'No or invalid table name "' . $tableName .
'" given.', 1369122038);
90 if (empty($extensionKey) || !is_string($extensionKey)) {
91 throw new \InvalidArgumentException(
'No or invalid extension key "' . $extensionKey .
'" given.', 1397836158);
95 $this->registry[$tableName][$fieldName] = $options;
96 $this->extensions[$extensionKey][$tableName][$fieldName] = $fieldName;
98 if (!isset(
$GLOBALS[
'TCA'][$tableName][
'columns']) && isset(
$GLOBALS[
'TCA'][$tableName][
'ctrl'][
'dynamicConfigFile'])) {
103 if (isset(
$GLOBALS[
'TCA'][$tableName][
'columns'])) {
118 public function get() {
129 return array_keys($this->extensions);
138 return array_keys($this->registry);
152 if ($configuration[
'row'][
'menu_type'] ==
'categorized_pages') {
154 } elseif ($configuration[
'row'][
'menu_type'] ==
'categorized_content') {
155 $table =
'tt_content';
159 throw new \UnexpectedValueException(
'The given menu_type is not supported.', 1381823570);
162 foreach ($this->registry as $tableName => $fields) {
163 if ($tableName === $table) {
164 foreach ($fields as $fieldName => $options) {
166 $configuration[
'items'][] = array($fieldLabel, $fieldName);
180 return isset($this->registry[$tableName][$fieldName]);
203 if (!isset($this->extensions[$extensionKey]) || !is_array($this->extensions[$extensionKey])) {
208 foreach ($this->extensions[$extensionKey] as $tableName => $fields) {
209 foreach ($fields as $fieldName) {
210 $sql .= sprintf($this->
template, $tableName, $fieldName);
231 foreach ($this->registry as $tableName => $fields) {
232 foreach ($fields as $fieldName => $_) {
245 $this->
addTcaColumn($tableName, $fieldName, $this->registry[$tableName][$fieldName]);
246 $this->
addToAllTCAtypes($tableName, $fieldName, $this->registry[$tableName][$fieldName]);
257 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'defaultCategorizedTables'],
260 foreach ($defaultCategorizedTables as $defaultCategorizedTable) {
262 $this->
add(
'core', $defaultCategorizedTable,
'categories');
281 if (isset(
$GLOBALS[
'TCA'][$tableName][
'columns'])) {
283 if (empty($options[
'fieldList'])) {
286 $fieldList = $options[
'fieldList'];
290 if (!empty($options[
'typesList'])) {
291 $typesList = $options[
'typesList'];
295 if (!empty($options[
'position'])) {
296 $position = $options[
'position'];
315 if (!in_array($tableName, $this->addedCategoryTabs)) {
316 $fieldList .=
'--div--;LLL:EXT:lang/locallang_tca.xlf:sys_category.tabs.category, ';
317 $this->addedCategoryTabs[] = $tableName;
319 $fieldList .= $fieldName;
336 protected function addTcaColumn($tableName, $fieldName, array $options) {
338 if (isset(
$GLOBALS[
'TCA'][$tableName][
'columns'])) {
340 $label =
'LLL:EXT:lang/locallang_tca.xlf:sys_category.categories';
341 if (!empty($options[
'label'])) {
342 $label = $options[
'label'];
347 if (isset($options[
'exclude'])) {
348 $exclude = (bool)$options[
'exclude'];
351 $fieldConfiguration = empty($options[
'fieldConfiguration']) ? array() : $options[
'fieldConfiguration'];
355 'exclude' => $exclude,
357 'config' => static::getTcaFieldConfiguration($tableName, $fieldName, $fieldConfiguration),
361 if (isset($options[
'l10n_mode'])) {
362 $columns[$fieldName][
'l10n_mode'] = $options[
'l10n_mode'];
364 if (isset($options[
'l10n_display'])) {
365 $columns[$fieldName][
'l10n_display'] = $options[
'l10n_display'];
367 if (isset($options[
'displayCond'])) {
368 $columns[$fieldName][
'displayCond'] = $options[
'displayCond'];
372 if (empty(
$GLOBALS[
'TCA'][
'sys_category'][
'columns'][
'items'][
'config'][
'MM_oppositeUsage'][$tableName])) {
373 $GLOBALS[
'TCA'][
'sys_category'][
'columns'][
'items'][
'config'][
'MM_oppositeUsage'][$tableName] = array();
375 if (!in_array($fieldName,
$GLOBALS[
'TCA'][
'sys_category'][
'columns'][
'items'][
'config'][
'MM_oppositeUsage'][$tableName])) {
376 $GLOBALS[
'TCA'][
'sys_category'][
'columns'][
'items'][
'config'][
'MM_oppositeUsage'][$tableName][] = $fieldName;
381 (!isset($options[
'interface']) || $options[
'interface'])
382 && !empty(
$GLOBALS[
'TCA'][$tableName][
'interface'][
'showRecordFieldList'])
385 $GLOBALS[
'TCA'][$tableName][
'interface'][
'showRecordFieldList'] .=
',' . $fieldName;
404 static public function getTcaFieldConfiguration($tableName, $fieldName =
'categories', array $fieldConfigurationOverride = array()) {
406 $fieldConfiguration = array(
408 'foreign_table' =>
'sys_category',
409 'foreign_table_where' =>
' AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.sorting ASC',
410 'MM' =>
'sys_category_record_mm',
411 'MM_opposite_field' =>
'items',
412 'MM_match_fields' => array(
413 'tablenames' => $tableName,
414 'fieldname' => $fieldName,
419 'renderMode' =>
'tree',
420 'treeConfig' => array(
421 'parentField' =>
'parent',
422 'appearance' => array(
424 'showHeader' => TRUE,
431 if (!empty($fieldConfigurationOverride)) {
434 $fieldConfigurationOverride
438 return $fieldConfiguration;
451 return array(
'sqlString' => $sqlString);
464 return array(
'sqlString' => $sqlString,
'extensionKey' => $extensionKey);
static mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys=TRUE, $includeEmptyValues=TRUE, $enableUnsetFeature=TRUE)
getDatabaseTableDefinition($extensionKey)
addToAllTCAtypes($tableName, $fieldName, array $options)
static getTcaFieldConfiguration($tableName, $fieldName='categories', array $fieldConfigurationOverride=array())
isRegistered($tableName, $fieldName='categories')
static addTCAcolumns($table, $columnArray, $addTofeInterface=FALSE)
static logDeprecatedFunction()
addTcaColumn($tableName, $fieldName, array $options)
static loadNewTcaColumnsConfigFiles()
static makeInstance($className)
addExtensionCategoryDatabaseSchemaToTablesDefinition(array $sqlString, $extensionKey)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
addCategoryTab($tableName, $fieldName)
static addToAllTCAtypes($table, $newFieldsString, $typeList='', $position='')
applyTcaForTableAndField($tableName, $fieldName)
add($extensionKey, $tableName, $fieldName='categories', array $options=array())
getCategoryFieldsForTable(array &$configuration)
applyTcaForPreRegisteredTables()
registerDefaultCategorizedTables()
addCategoryDatabaseSchemaToTablesDefinition(array $sqlString)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static inList($list, $item)
getDatabaseTableDefinitions()