Add category wizard: Use first pid from ext configuration `category_folders` if given
I would suggest to use the first pid from the list in extension configuration `category_folders` if given instead of the current pid, because categorys added in this way could never listed in the tca tree.
You must modify the params for add wizard and set `pid` to the first value from configuration.
Example (in ext_tables.php):
$categoryFolderPidList = \TYPO3\CMS\Media\Utility\MediaFolder::getCategoryFolders(); $categories = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $categoryFolderPidList); $options = array( 'fieldConfiguration' => array( 'wizards' => array( 'add' => array( 'params' => array( 'pid' => $categories ) ) ) ) ); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable('media', 'sys_file', 'categories', $options);
#2 Updated by Alexander Pankow almost 6 years ago
- Status changed from Closed to New
Oh, I've not noticed that.
Why the option `category_folders` was removed? I think it is important to define the pid where categories can be found. Maybe it is not required to load categories from all pages.
If so, I would suggest to add a new option in ext_conf_template.txt (with root level as default value):
# cat=basic//; type=int+; label= Uid of the page where a category is created if added via the add-wizard beside the category tree. new_category_uid = 0
$options['fieldConfiguration']['wizards']['add']['params']['pid'] = \TYPO3\CMS\Media\Utility\ConfigurationUtility::getInstance()->get('new_category_uid');
Any other suggestions?
#5 Updated by Fabien Udriot over 5 years ago
Hey, I don't make the "add" wizard to appear next to the category tree. Is it me or something else?
Here is the code I have put in ext_tables.php. (context: CMS 6.2, media master)
$options = array( 'fieldConfiguration' => array( 'wizards' => array( 'add' => array( 'params' => array( 'pid' => 1, # <--- hard-coded value for testing ) ) ) ) ); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable('media', 'sys_file_metadata', 'categories', $options);
#6 Updated by Lorenz Ulrich about 5 years ago
- Assignee changed from Lorenz Ulrich to Fabien Udriot
@ Fabien: The core currently only adds the category tree (in DefaultConfiguration.php). It comes with no configuration for wizards, so you must configure the wizard as a whole:
$categoryWizardsConfiguration = array( '_PADDING' => 1, '_VERTICAL' => 1, 'add' => Array( 'type' => 'script', 'title' => 'Create new', 'icon' => 'add.gif', 'params' => array( 'table' => 'sys_category', 'pid' => '###CURRENT_PID###', 'setValue' => 'prepend' ), 'script' => 'wizard_add.php', ), ); $GLOBALS['TCA']['sys_file_metadata']['columns']['categories']['config']['wizards'] = $categoryWizardsConfiguration;
I'm not sure if it's really Medias task to provide this (and an additional configuration in the Extension Configuration)? But you could ask the same question for replacing files in the sys_file TCEFORM. Should we implement it anyway?