我有自己的扩展,它有两个操作的控制器:listAction和show Action。
问题:我可以在同一个页面上显示两个操作吗?
在特定页面,我用自己的插件创建了一个插入插件记录,在插件后端配置的flexform中,我通过switchableControllerActions字段选择了“列表操作”。列表操作包含产品列表,其中包含指向产品显示操作的链接。
那我想要什么呢?
我有页面产品。URL就是一个例子。com/products(这是我的列表操作)
对于show操作,我需要类似示例的URL。com/产品/产品名称
我找到了一个具有此功能的扩展。gb_events。我注意到在flexform的plugin的SwitchableControlllerActions字段中有这样的内容:
<switchableControllerActions>
<TCEforms>
<label>LLL:EXT:gb_events/Resources/Private/Language/locallang_db.xlf:flexform.default.switchableControllerActions</label>
<config>
<type>select</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:gb_events/Resources/Private/Language/locallang_db.xlf:flexform.default.switchableControllerActions.upcoming</numIndex>
<numIndex index="1">Event->upcoming;Event->list;Event->calendar;Event->show;Event->export</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:gb_events/Resources/Private/Language/locallang_db.xlf:flexform.default.switchableControllerActions.list</numIndex>
<numIndex index="1">Event->list;Event->upcoming;Event->calendar;Event->show;Event->export</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:gb_events/Resources/Private/Language/locallang_db.xlf:flexform.default.switchableControllerActions.calendar</numIndex>
<numIndex index="1">Event->calendar;Event->upcoming;Event->list;Event->show;Event->export</numIndex>
</numIndex>
<numIndex index="3" type="array">
<numIndex index="0">LLL:EXT:gb_events/Resources/Private/Language/locallang_db.xlf:flexform.default.switchableControllerActions.details</numIndex>
<numIndex index="1">Event->show;Event->list;Event->upcoming;Event->calendar;Event->export</numIndex>
</numIndex>
</items>
<maxitems>1</maxitems>
<size>1</size>
</config>
<onChange>reload</onChange>
</TCEforms>
</switchableControllerActions>
我已经更新了我的flexform配置。但它仍然不起作用。当我点击带有ShowAction的链接后,我有了相同的列表视图。
提前感谢。我将感谢任何帮助。
结构上更合理的方法是在控制器中保留这种逻辑。
将showAction设置为defaut,并检查其初始化中的参数。如果未提供任何产品,或无法加载指定的产品,请转至列表操作。
/**
* initialize action show
* @return void
*/
public function initializeShowAction() {
if($this->request->hasArgument('product')){
if( $product=$this->stadtRepository->findByUid(
intval($this->request->getArgument('product'))
) ){
$this->request->setArgument('product',$product);
return;
}
}
$this->forward('list');
}
确保在switchableControllerActions
中同时包含列表和详细操作,如下所示:
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:gb_events/Resources/Private/Language/locallang_db.xlf:flexform.default.switchableControllerActions.upcoming</numIndex>
<numIndex index="1">Event->list;Event->calendar;Event->show</numIndex>
</numIndex>
然后,在键入脚本模板中,使用一个条件根据详细信息uid设置控制器/操作:
[globalVar = GP:tx_myext_plugin|showUid > 0]
config.defaultGetVars {
tx_myext_plugin.action = show
}
[global]
要从RealUrl中的URL获取其他控制器参数,请使用以下内容:
array(
'GETvar' => 'tx_extkey_plugin[action]',
'noMatch' => 'bypass'
),
你可以在这篇德语文章中找到更多关于这个技巧的信息
前两章讨论了几种保持 DRY 和灵活性的函数式编程技术: 函数组合(function composition) 部分函数应用(partial function application) 柯里化(currying) 这一章依旧围绕代码灵活性而来,不过不再讨论作为头等公民的函数,而是类型系统(注意:并不是要真的去研究类型系统)。 你将学习 类型类 ! 可能你会觉得这没有实际意义,认为这是被 Haske
当我运行我的代码时,它返回了错误:类型“Future”不是类型转换中“List”类型的子类型。我该如何修复它?它是在我从Firebase获取数据之前匹配引擎运行的?我试图将wait添加到List demoProfiles=getdata()作为wait List;但它返回错误。我真的是新手,这个问题已经困扰了我一整天。请帮帮我
我是新手。我正在开发一个测验应用程序,并拥有以下三个dart文件: 主要的飞奔 question.dart answer.dart 当我在android studio中的android上运行应用程序时,出现以下错误: ══╡ 小部件库捕获的异常╞═══════════════════════════════════════════ 生成MyApp时引发了以下类型的错误(脏,状态:_MyAppSta
JPA存储过程参数注释 https://docs.oracle.com/javaee/7/api/javax/persistence/StoredProcedureParameter.html 根据文档,它的类型是JDBC类型。 它应该是Java类型,因为它是类(不是 java.sql.Types.xxx 或JDBCType)?
在存储到本地数据库之前,将字符串转换为对象的正确方法是什么? 这是的输出: 我试图将其转换为CreatedBy对象 创造的 这里是我的本地表列 错误
我正在开发一个依靠API REST调用的flutter应用程序。来自API的响应有点复杂。当调用我的API(例如:api/产品)时,我可以从日志中看到响应:但是我有这个错误: 类型列表 StackTrace: [更新]:退货产品响应。fromJson(response)而不是response ProductsRespository: ProductsBloc: 回应: ApiProvider: 模
我是个新手。当我运行代码时,我得到一个错误:“Future”类型不是“List”类型的子类型。如果我改变屏幕,我将得到错误:NoSuchMethodError:方法“map”被调用为null。我怎样才能解决它?谢谢你帮助我。
我从Firestore示例中复制了一段代码: 但是我得到了这个错误 这里出了什么问题?