* Utilities to manage the plugins of an extension
*
* @package Extbase
- * @subpackage extbase
+ * @subpackage Utility
* @version $ID:$
*/
class Tx_Extbase_Utility_Plugin {
/**
- * Add an Extbase PlugIn to TypoScript
+ * Add auto-generated TypoScript to configure the Extbase Dispatcher.
*
* When adding a frontend plugin you will have to add both an entry to the TCA definition
* of tt_content table AND to the TypoScript template which must initiate the rendering.
* Since the static template with uid 43 is the "content.default" and practically always
* used for rendering the content elements it's very useful to have this function automatically
- * adding the necessary TypoScript for calling your plugin. It will also work for the
- * extension "css_styled_content"
- * FOR USE IN ext_tables.php FILES
+ * adding the necessary TypoScript for calling the appropriate controller and action of your plugin.
+ * It will also work for the extension "css_styled_content"
+ * FOR USE IN ext_localconf.php FILES
* Usage: 2
*
* @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 $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 $nonCachableControllerActions 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
* @return void
*/
- public static function registerPlugin($extensionName, $pluginName, $pluginTitle, array $controllerActions, array $nonCachableControllerActions = array()) {
+ public static function configureDispatcher($extensionName, $pluginName, array $controllerActions, array $nonCachableControllerActions = array()) {
if (empty($pluginName)) {
throw new InvalidArgumentException('The plugin name must not be empty', 1239891987);
}
t3lib_extMgm::addTypoScript($extensionName, 'setup', '
# Setting ' . $extensionName . ' plugin TypoScript
' . $pluginContent, 43);
+ }
+ /**
+ * Register an Extbase PlugIn into backend's list of plugins
+ * FOR USE IN ext_tables.php FILES
+ *
+ * @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
+ * @return void
+ */
+ public static function registerPlugin($extensionName, $pluginName, $pluginTitle) {
+ if (empty($pluginName)) {
+ throw new InvalidArgumentException('The plugin name must not be empty', 1239891987);
+ }
+ if (empty($extensionName)) {
+ throw new InvalidArgumentException('The extension name was invalid (must not be empty and must match /[A-Za-z][_A-Za-z0-9]/)', 1239891989);
+ }
+ $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionName)));
+ $pluginSignature = strtolower($extensionName) . '_' . strtolower($pluginName);
+
t3lib_extMgm::addPlugin(array($pluginTitle, $pluginSignature), 'list_type');
}
}
}
-?>
\ No newline at end of file
+?>