Index: t3lib/class.t3lib_extmgm.php =================================================================== --- t3lib/class.t3lib_extmgm.php (revision 7251) +++ t3lib/class.t3lib_extmgm.php (working copy) @@ -1500,6 +1500,104 @@ } return $out; } + + /** + * Adds a new content element to the TCA and new content wizard. Type, title, description, icon, and wizard icon can be provided or will be set based on convention. + * + * @param string The extension key providing the content element. + * @param string The unique key for the content element. + * @param string Optional path to the flexform file. If not set, EXT:{extensionKey}/{key}/flexform.xml will be used. + * @param string Optional type for use in the new content wizard. + * @param string Optional title. If not set, LLL:EXT:{extensionKey}/{key}/locallang.xml:tt_content.{key}.title will be used. + * @param string Optional description. If not set, LLL:EXT:{extensionKey}/{key}/locallang.xml:tt_content.{key}.description will be used. + * @param string Option icon path. If not set, EXT:{extensionKey}/{key}/icon.gif will be used. + * @param string Option icon path. If not set, EXT:{extensionKey}/{key}/wizard-icon.gif will be used. + * @return void + */ + public function addContentElement($extensionKey, $key, $flexformPath = '', $type = '', $title = '', $description = '', $icon = '', $wizardIcon = '') { + t3lib_div::loadTCA('tt_content'); + + // Set defaults for title, description, icons, and content element type. + $locallangPath = 'LLL:EXT:' . $extensionKey . '/' . $key . '/locallang.xml:tt_content.' . $key . '.'; + if (!$title) { + $title = $locallangPath . 'title'; + } + if (!$description) { + $description = $locallangPath . 'description'; + } + if (!$icon) { + $icon = 'EXT:' . $extensionKey . '/' . $key . '/icon.gif'; + } + if (!$wizardIcon) { + $wizardIcon = t3lib_extMgm::extRelPath($extensionKey) . $key . '/wizard-icon.gif'; + } + if (!$type) { + $type = 'special'; + } + if (!$flexformPath && @file_exists(t3lib_extMgm::extPath($extensionKey) . $key . '/flexform.xml')) { + $flexformPath = 'FILE:EXT:' . $extensionKey . '/' . $key . '/flexform.xml'; + } + + if ($flexformPath) { + $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['*,' . $key] = $flexformPath; + $GLOBALS['TCA']['tt_content']['types'][$key] = array( + 'showitem' => 'CType;;4;;1-1-1, hidden, header;;3;;2-2-2, linkToTop;;;;3-3-3, --div--;' . $title . ', pi_flexform;;;;1-1-1, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, starttime, endtime' + ); + } else { + $GLOBALS['TCA']['tt_content']['types'][$key] = array( + 'showitem' => 'CType;;4;;1-1-1, hidden, header;;3;;2-2-2, linkToTop;;;;3-3-3, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, starttime, endtime' + ); + } + + t3lib_extMgm::addPlugin(array( + $title, + $key, + $icon + ), 'CType'); + + $TSConfig = + 'wizards.newContentElement.wizardItems.' . $type . ' { + elements { + ' . $key . ' { + icon = ' . $wizardIcon . ' + title = ' . $title . ' + description = ' . $description . ' + tt_content_defValues { + CType = ' . $key .' + } + } + } + show := addToList(' . $key .') + }'; + + t3lib_extMgm::addPageTSConfig( + 'mod.' . $TSConfig . chr(10) . + 'templavoila.' . $TSConfig . chr(10) + ); + } + + /** + * Adds content to the default TypoScript setup by reading from a file. + * + * @param string The extension key providing the content element. + * @param string The unique key for the content element. + * @param string The path to the TypoScript file. If not set, EXT:{extensionKey}/{key}/content.ts will be used. + * @return void + */ + public function addTypoScriptFromFile($extensionKey, $key, $typoScriptPath = '') { + if (!$typoScriptPath) { + $typoScriptPath = t3lib_extMgm::extPath($extensionKey) . $key . '/content.ts'; + } + + $type = 'CType'; + $typoScriptContent = t3lib_div::getURL($typoScriptPath); + if ($typoScriptContent) { + t3lib_extMgm::addTypoScript($key, 'setup', ' + # Setting ' . $key . ' TypoScript + ' . $typoScriptContent . ' + ', 43); + } + } } ?> \ No newline at end of file Index: typo3/sysext/cms/tslib/class.tslib_content.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_content.php (revision 7251) +++ typo3/sysext/cms/tslib/class.tslib_content.php (working copy) @@ -640,6 +640,12 @@ case 'QTOBJECT': $content.=$this->QTOBJECT($conf); break; + case 'FFSECTION': + $content.=$this->FFSECTION($conf); + break; + case 'HEADERDATA': + $content.=$this->HEADERDATA($conf); + break; default: // call hook functions for extra processing if($name && is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) { @@ -2968,14 +2974,71 @@ return $content; } + /** + * Iterates over a flexform section, returning the combined output of all + * elements within the specified section. + * + * @param array $conf: The TypoScript configuration. + * @return string + * + * + * Example: + * + * 20 = FFSECTION + * 20.rootPath = t3datastructure : pi_flexform->images/el + * 20 { + * wrap =