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?

4

2 回答 2

5

您需要正确使用 FlexForm 来设置可切换操作列表。

其他选项是创建另一个默认操作为listfeatured.

如果您决定只使用单个插件,您只需向我们展示/描述您在 FlexForm 中尝试了什么(可能是新问题)

编辑:正如您在问题中向我们展示的那样,您决定哪个插件是给定插件Controlleraction默认插件,因此要添加将使用现有控制器的新插件,只需将其添加到您的ext_localconf.php

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

如果您希望能够在 BE 中使用它,您可能还需要registerPlugin在您的ext_tables.php中(如果 ie.plugin 应该只与 TS 一起放置,则可以省略)。您将通过以下方式执行此操作:Tx_Extbase_Utility_Plugin::registerPlugin

于 2014-02-04T16:26:39.353 回答
2

除了 FlexForm 之外,还有另一种方法可以读取插件中的插件模式字段PHP

现在,我正在开发一个插件,并希望区分 modi。一些方式 B 应该从请求的一开始就设置,更好的是它不应该通过 HTTP 发送,而是从数据模型中读取。

所以我在“插件模式”字段中设置了文本“myModusB”,并在我检查的插件中:

exit (print_r($this, true));

然后我发现

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

所以在插件中通过写

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

我会得到文本并可以处理它。

这是针对版本 6.1.3 进行测试的。

于 2014-07-03T14:23:16.207 回答