Domanda

I have set up an extbase extension in a TYPO3 4.5 site with the extension builder, containing just the default listAction in the controller.

Now I would like to add a new Action, and it doesn't work.

I don't need (aka. can't get to work) a flexform to choose the controller action.

As there's a field "Plugin mode", I thought I could just manually enter the action here:

typo3 plugin mode

And extend the plugin configuration as such in ext_localconf.php:

Tx_Extbase_Utility_Extension::configurePlugin(
    $_EXTKEY,
    'Pluginname',
    array(
        'Controllername' => 'list,listfeatured',
    ),
);

Also, in the controller, I have added a new action.

/**
 * action listfeatured
 *
 * @return void
 */
public function listfeaturedAction() {
    // do something
}

But, alas, the action is not called at all.

Did I interpret the field "plugin mode" wrong? Did I miss something?

Alternatively: Can I set the action for a "backend" plugin via TS as well?

È stato utile?

Soluzione

You need to use FlexForm correctly to set list of switchable actions.

Other option is creating another plugin for which default action is listfeatured.

If you will decide to use single plugin only just you need to show/describe us what did you try in FlexForm (probably new question)

Edit: As you showed us yourself in your question it's you deciding which Controller and action are default for given plugin, so to add new plugin which will use existing controller, just add this to your ext_localconf.php

Tx_Extbase_Utility_Extension::configurePlugin(
    $_EXTKEY,
    'MyFeaturedPlugin',
    array(
        'Controllername' => 'listfeatured',
    ),
);

you may also need to registerPlugin in your ext_tables.php if you want to be able to use it in BE (can be ommited if ie. plugin should be placed only with TS). You will do this with: Tx_Extbase_Utility_Plugin::registerPlugin

Altri suggerimenti

Besides FlexForm there is a further way of reading the field Plugin Mode in the plugin with PHP.

Right now, I'm working on a plugin and wish to distinguish between modi. Some modus B should be set from the very beginning of the request, even better it should not be sent over HTTP but read from the data model.

So I set the text 'myModusB` in the field "Plugin Mode", and in the plugin I inspect:

exit (print_r($this, true));

Then I find

[cObj] => TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer Object
    ...
    [data] => Array
            (
       ...
       [select_key] => myModusB
       ...

So in the plugin by writing

$modus = $this->cObj->data["select_key"];

I'll get the text and can process it.

This is tested for version 6.1.3.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top