TYPO3 9如何为widget.paginate设置过滤器?示例:
<f:form name="filter" controller="myController" pluginName="Plugin" action="list" method="POST">
<f:if condition="{types}">
<f:for each="{types}" as="type">
<f:form.checkbox name="filter[types][]" value="{type.uid}" />
</f:for>
</f:if>
...
<f:widget.paginate objects="{myObject}" as="Objects" configuration="{itemsPerPage: 20, insertAbove: 1, insertBelow: 1, maximumNumberOfLinks: 10, addQueryString: 1, addQueryStringMethod: 'POST'}">...
但是这仅适用于第一页-第二页会丢失参数。
[下一个问题:如何为分页设置nextPageLink(ajax)? f:widget.link不起作用:https://forge.typo3.org/issues/89522谢谢:)
最后,我找到了2个解决方案:
plugin.tx_yourext_plugin.features.requireCHashArgumentForActionArguments = 0
和
public function listAction (int $ argument = 0) {...
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_yourext_plugin[argument]';
和
public function listAction() {
$argument = $this->request->getArgument('argument');
FLUID / HTML:
解决方案1:拥有普通的HTML表单(不包含FLUID / ViewHelper):
<form action = '<f:uri.action action = "cunning" controller = "job"/>' method = "GET">
<select name = "tx_yourext_plugin [argument]">...
解决方案2:拥有以下内容的ViewHelper-然后,他可以用作原件(他仅阻止产品自动生成__引荐来源网址的隐藏字段以及trustedproperties的隐藏字段):
class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper {
protected function renderHiddenReferrerFields () {
return ";
}
protected function renderTrustedPropertiesField () {
return ";
}
}
非常感谢https://www.ophidia.net/fluid-fform-referrer-deaktivieren/
对于两种解决方案:流体果胶酸盐:(注意:从TYPO3 10开始,addQueryStringMethod:'POST'已被描述)
<f:widget.paginate... configuration = "{... addQueryString: 'true', addQueryStringMethod: 'GET'}">
但是我还有一个问题-我没有过滤器形式的漂亮网址。因此,如果我发送表格的网址不是很好-但是如果我在此之后使用分页,则该网址很好并且很干净。
有人有主意吗?
MyPlugin:
type: Extbase
extension: MyExtKeyNameSpace
plugin: PluginName
defaultController: 'Controller::list'
routes:
# - { routePath: '/{page-label}-{page}', _controller: 'Controller::list', _arguments: {'page': '@widget_0/currentPage'} }
# - { routePath: '/{type-label}-{type}', _controller: 'Controller::list', _arguments: {'type': 'pluginTypes'} }
# - { routePath: '/{area-label}-{area}', _controller: 'Controller::list', _arguments: {'area': 'pluginAreas'} }
# - { routePath: '/type-{type}/area-{area}', _controller: 'Controller::list', _arguments: {'type': 'pluginTypes', 'area': 'pluginAreas'} }
- { routePath: '/{page-label}{page}/{type-label}{type}/{area-label}{area}', _controller: 'Controller::list', _arguments: {'page': '@widget_0/currentPage', 'type': 'pluginTypes', 'area': 'pluginAreas'} }
- { routePath: '/{company_slug}/{plugin_slug}', _controller: 'Controller::show', _arguments: {'company_slug': 'company', 'plugin_slug': 'plugin'} }
defaults:
page: ''
type: ''
area: ''
requirements:
page: '\d+'
type: '\d+'
area: '\d+'
aspects:
page: { type: StaticRangeMapper, start: '1', end: '100' }
page-label: { type: LocaleModifier, default: 'page-', localeMap: [{ locale: 'en_.*', value: 'page-' }, { locale: 'de_.*', value: 'seite-' }] }
company_slug: { type: 'PersistedAliasMapper', tableName: 'tt_address', routeFieldName: 'slug' }
plugin_slug: { type: 'PersistedAliasMapper', tableName: 'tx_myextkey_domain_model_plugin', routeFieldName: 'slug' }
type-label: { type: LocaleModifier, default: 'type-', localeMap: [] }
area-label: { type: LocaleModifier, default: 'area-', localeMap: [] }