2

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?

2 Answers 2

5

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

Sign up to request clarification or add additional context in comments.

4 Comments

thanks! so what's that plugin mode field for? can I access it via php?
Have no idea :D didn't see it before ;) which version of Builder do you use ? Isn't it added manually by other dev?
Oh! That's why it was ungooglable?! :-) - Just a quick follow up: the second plugin works flawlessly. I don't even need the controller action, I can do it with a view helper. Is there a way to skip the second controller, but assign a different template to the view for that plugin (convention over configuration seems to force that structure though...)
to the rescue - thanks again! my second plugin works fine. the last question was a bit theoretical and confusing, never mind. About the plugin mode field: maybe it's deprecated in newer TYPO3 versions. I now found this: lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2011-January/…
2

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.

3 Comments

Ah, interesting! Apart from interfering with Tx_Extbase_Utility_Extension::configurePlugin, do you think this can be used to define which controller to run?
Enlighten me :-) what do you mean by "controller"? In Typo3, I see the plugin, the T3 core that forwards plugin calls to my plugin code, the template and other components. Are there several controllers in the T3 core that handle an URL?
my question is about extbase in TYPO3 6.x, where there can be various controllers in an extension. That's what is offered in the parameter "Controllername" (see original example). I admit I'm not sure if what I mean is called a Controller or a "Controller action". It's the "do" part of an MVC extension, so to speak

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.