简体   繁体   English

如何让流体自动完成小部件在 TYPO3 v10 中工作

[英]How to get the fluid autocomplete widget to work in TYPO3 v10

I am trying to get the Fluid search widget autocomplete to work in my custom extension in TYPO3 v10.我正在尝试让 Fluid 搜索小部件自动完成功能在 TYPO3 v10 的自定义扩展中工作。 The problem is that I am getting the following error message when typing anything in my search field:问题是我在搜索字段中输入任何内容时收到以下错误消息:

http://www.local-website.com/?id=2&type=7076&action=autocomplete&term=teststring - 500 (Internal Server Error).. After examining the exact response of that page request, here's the specific error: http://www.local-website.com/?id=2&type=7076&action=autocomplete&term=teststring - 500(内部服务器错误)..在检查了该页面请求的确切响应后,以下是具体错误:

"No widget context was found for the Ajax Widget Identifier "". This only happens if AJAX URIs are called without including the widget on a page" “没有为 Ajax 小部件标识符”找到小部件上下文。只有在调用 AJAX URI 时未在页面上包含小部件时才会发生这种情况“

Here's my Fluid autocomplete widget code as I have implemented in my extension's Fluid template:这是我在扩展的 Fluid 模板中实现的 Fluid 自动完成小部件代码:

<f:widget.autocomplete for="search-items" objects="{allItems}" searchProperty="title" storeSession="false"/>

I have not set up anything specific for AJAX (ie I have not set up page type 707 as I would not know how to do this)...我没有为 AJAX 设置任何特定的东西(即我没有设置页面类型707 ,因为我不知道该怎么做)...

Here's the widget information page I'm using: https://docs.typo3.org/other/typo3/view-helper-reference/10.4/en-us/typo3/fluid/latest/Widget/Autocomplete.html Here's the widget information page I'm using: https://docs.typo3.org/other/typo3/view-helper-reference/10.4/en-us/typo3/fluid/latest/Widget/Autocomplete.html

This happens if the new parameter storeSession="false" is used.如果使用了新参数storeSession="false" ,就会发生这种情况。 In TYPO3 v9 this parameter didn't exist.在 TYPO3 v9 中,此参数不存在。
Using the widget like this should work like intended:像这样使用小部件应该可以按预期工作:

<f:widget.autocomplete for="search-items" objects="{allItems}" searchProperty="title"/>

Usually the parameteres look like this:通常参数如下所示:

?id=1&type=7076&fluid-widget-id=9c31f0bb1b5f5f953e84f6b57af102b4&action=autocomplete&term=Ma

When the parameter storeSession=false is used it looks like this:当使用参数storeSession=false时,它看起来像这样:

?id=1&type=7076&action=autocomplete&term=Ma

That means that the widget doesn't transfer the correct link to the AJAX script.这意味着小部件不会将正确的链接传输到 AJAX 脚本。

The issue with the parameter storeSession is clearly a bug but I never expect that this will be still fixed in the official TYPO3 v10 as widgets are in general removed in TYPO3 v11 already.参数storeSession的问题显然是一个错误,但我从没想到这仍会在官方 TYPO3 v10 中得到修复,因为小部件通常在 TYPO3 v11 中已被删除。
Nevertheless I reported it and it can be found here: https://forge.typo3.org/issues/98173尽管如此,我还是报告了它,它可以在这里找到: https://forge.typo3.org/issues/98173

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM