Index: Classes/Utility/Extension.php =================================================================== --- Classes/Utility/Extension.php (revision 2689) +++ Classes/Utility/Extension.php (working copy) @@ -41,6 +41,10 @@ * used for rendering the content elements it's very useful to have this function automatically * adding the necessary TypoScript for calling the appropriate controller and action of your plugin. * It will also work for the extension "css_styled_content" + * $pluginType determines the type of frontend plugin: + * "list_type" (default) - the good old "Insert plugin" entry + * "CType" - a new content element type + * (Remember that your $pluginType definition should correspond to the column/items array in $TCA[tt_content] where you added the selector item for the element! See registerPlugin() function) * FOR USE IN ext_localconf.php FILES * Usage: 2 * @@ -49,9 +53,10 @@ * @param string $controllerActions is an array of allowed combinations of controller and action stored in an array (controller name as key and a comma separated list of action names as value, the first controller and its first action is chosen as default) * @param string $nonCacheableControllerActions is an optional array of controller name and action names which should not be cached (array as defined in $controllerActions) * @param string $defaultControllerAction is an optional array controller name (as array key) and action name (as array value) that should be called as default + * @param string $pluginType determines the type of frontend plugin * @return void */ - public static function configurePlugin($extensionName, $pluginName, array $controllerActions, array $nonCacheableControllerActions = array()) { + public static function configurePlugin($extensionName, $pluginName, array $controllerActions, array $nonCacheableControllerActions = array(), $pluginType = 'list_type') { if (empty($pluginName)) { throw new InvalidArgumentException('The plugin name must not be empty', 1239891987); } @@ -103,9 +108,10 @@ # Setting ' . $extensionName . ' plugin TypoScript ' . $pluginTemplate); - $pluginContent = trim(' -tt_content.list.20.' . $pluginSignature . ' = USER -tt_content.list.20.' . $pluginSignature . ' { + + + $pluginContent = trim(' +{ userFunc = tx_extbase_dispatcher->dispatch pluginName = ' . $pluginName . ' extensionName = ' . $extensionName . ' @@ -118,6 +124,28 @@ view =< plugin.tx_' . strtolower($extensionName) . '.view _LOCAL_LANG =< plugin.tx_' . strtolower($extensionName) . '._LOCAL_LANG }'); + + + switch ($pluginType) { + case 'list_type': + $pluginContent = trim(' +tt_content.list.20.' . $pluginSignature . ' = USER +tt_content.list.20.' . $pluginSignature . $pluginContent); + break; + case 'CType': + $pluginContent = trim(' +tt_content.' . $pluginSignature . ' = COA +tt_content.' . $pluginSignature . ' { + 10 = < lib.stdheader + 20 = USER + 20 ' . $pluginContent . ' +}'); + break; + default; + throw new InvalidArgumentException('The pluginType is not suported', 1289136293); + break; + } + t3lib_extMgm::addTypoScript($extensionName, 'setup', ' # Setting ' . $extensionName . ' plugin TypoScript @@ -131,9 +159,10 @@ * @param string $extensionName The extension name (in UpperCamelCase) or the extension key (in lower_underscore) * @param string $pluginName must be a unique id for your plugin in UpperCamelCase (the string length of the extension key added to the length of the plugin name should be less than 32!) * @param string $pluginTitle is a speaking title of the plugin that will be displayed in the drop down menu in the backend + * @param string $type Type (eg. "list_type") - basically a field from "tt_content" table * @return void */ - public static function registerPlugin($extensionName, $pluginName, $pluginTitle) { + public static function registerPlugin($extensionName, $pluginName, $pluginTitle, $pluginType = 'list_type') { if (empty($pluginName)) { throw new InvalidArgumentException('The plugin name must not be empty', 1239891987); } @@ -143,7 +172,7 @@ $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionName))); $pluginSignature = strtolower($extensionName) . '_' . strtolower($pluginName); - t3lib_extMgm::addPlugin(array($pluginTitle, $pluginSignature), 'list_type'); + t3lib_extMgm::addPlugin(array($pluginTitle, $pluginSignature), $pluginType); } /**