在typoscript中分配插件

时间:2013-11-15 10:53:56

标签: typo3 typoscript typo3-6.1.x

我有一个插件http://typo3.org/extensions/repository/view/aw_consume

我正在使用它作为其工作的内容元素

当我尝试分配给我的typoscript中的子部分时,没有任何显示

LOGOUT < plugin.tx_awconsume.widgets.menu

此插件是使用TYPO3 6.1.4

上安装的extension_builder扩展创建的

更新3

plugin.tx_awconsume {
    view {
        templateRootPath = {$plugin.tx_awconsume.view.templateRootPath}
        partialRootPath = {$plugin.tx_awconsume.view.partialRootPath}
        layoutRootPath = {$plugin.tx_awconsume.view.layoutRootPath}
    }
    persistence {
        storagePid = {$plugin.tx_awconsume.persistence.storagePid}
    }
    features {
        # uncomment the following line to enable the new Property Mapper.
        # rewrittenPropertyMapper = 1
    }

    widgets {
        menu = USER
        menu {
            userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
            pluginName = FeAwConsume
            extensionName = AwConsume
            controller = ConsumerItem
            action = list
            vendorName = Alexweb
        }
    }
}

ext_tables.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    $_EXTKEY,
    'FeAwConsume',
    'fe_awconsume'
);

ext_localconf.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Alexweb.' . $_EXTKEY,
    'FeAwConsume',
    array(
        'ConsumerItem' => 'list, show, new, create, delete',

    ),
    // non-cacheable actions
    array(
        'ConsumerItem' => 'create, delete',

    )
);

我根据@lorenz的答案更新了代码片段,但我仍然没有输出

我也推了TER 0.1.5的最新版本

更新4

我确实设法在添加

后才获得预期的输出
plugin.tx_awconsume.widgets {
    menu = USER
    menu {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        pluginName = FeAwConsume
        extensionName = AwConsume
        controller = ConsumerItem
        action = list
        vendorName = Alexweb
    }
}

来自\typo3conf\ext\aw_consume\Configuration\TypoScript\setup.txt

的模板typoscript文件

它最初是由extension_builder扩展程序放置的,但我觉得这不是一个好主意

1 个答案:

答案 0 :(得分:2)

如果仔细查看ext_localconf.php,您会注意到您使用的是供应商名称。供应商名称应以大写字母开头,因此您的 ext_localconf.php 应为:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Alexweb.' . $_EXTKEY,
    'MyPlugin',
    array(
        'ConsumerItem' => 'list, show, new, create, delete',        
    ),
    array(
        'ConsumerItem' => 'create, delete',     
    )
);

您的 ext_tables.php 应如下所示:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    $_EXTKEY,
    'MyPlugin',
    'Speaking name of my plugin'
);

插件的TypoScript对象应包含供应商名称(属性为vendorName,而非供应商):

    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
    pluginName = MyPlugin
    extensionName = AwConsume
    vendorName = Alexweb
    controller = ConsumerItem
    action = list

请记住,您的类还必须包含供应商名称/使用正确的命名空间:

namespace Alexweb\AwConsume\Controller;

class ConsumerItemController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
}

然后你应该没事。

扩展名是扩展密钥的UpperCamelCase变体,因此如果您的扩展名为“aw_consume”,则扩展名为“AwConsume”。该名称用于类

插件名称是扩展程序中特定插件的名称。由于扩展中可以有许多插件,因此您应该为它选择一个适合的名称。插件名称也应该是UpperCamelCase。您可以为同一个控制器安装多个插件,因此插件不必像控制器那样命名。

另见http://forge.typo3.org/projects/typo3v4-mvc/wiki/FAQ#What-is-the-Extension-Name