Assign plugin in typoscript

本小妞迷上赌 提交于 2019-12-12 20:27:21

问题


I have a plugin http://typo3.org/extensions/repository/view/aw_consume

I'm using it as a content element it's working

When I try to assign to a subpart in my typoscript nothing shows up

LOGOUT < plugin.tx_awconsume.widgets.menu

this plugin was created with the extension_builder extension installed on TYPO3 6.1.4

update 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',

    )
);

I have updated the code snippets according to @lorenz answer but im still getting no output

I have also pushed the latest version in TER 0.1.5

update 4

I did manage to get the expected output only after adding

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

To the template typoscript file from \typo3conf\ext\aw_consume\Configuration\TypoScript\setup.txt

Where it was originally placed by the extension_builder extension however I got a feeling that this is not really a good idea


回答1:


If you have a close look at your ext_localconf.php, you will notice that you use a vendor name. The vendor name should start with Uppercase so your ext_localconf.php should read:

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

Your ext_tables.php should look like this:

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

The TypoScript object of your plugin should include the vendor name (the property is vendorName, not vendor):

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

Keep in mind that your classes also must include the vendor name/make use of the correct namespace:

namespace Alexweb\AwConsume\Controller;

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

Then you should be fine.

The extension name is the UpperCamelCase variant of your extension key, so if your extension key is "aw_consume", your extension name is "AwConsume". This name is used in the classes

The plugin name is the name of a particular plugin that is part of your extension. Since there can be many plugins in an extension, you should choose a fitting name for it. The plugin name should also be UpperCamelCase. You can have multiple plugins for the same controllers, therefore the plugin doesn't have to be named like the controller.

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



来源:https://stackoverflow.com/questions/19999395/assign-plugin-in-typoscript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!