typo3 - Typoscript DatabaseQueryProcessor - 如果字段为空则滑动
问题描述
我的页面设置中有一个 mm 关系字段。
$myext_pages_fields = array(
'tx_myext_topofferitem' => Array(
'label' => 'Relation',
'config' => Array(
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'tx_myext_topofferitem',
'MM' => 'tt_content_tx_topofferitem_mm',
'size' => '20',
'maxitems' => '99',
'show_thumbs' => '1',
'suggestOptions' => [
'default' => [
'searchWholePhrase' => 1
],
'pages' => [
'searchCondition' => 'doktype = 1'
]
],
)
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('pages', $myext_pages_fields);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages', '--div--;Top Offers,tx_myext_topofferitem');
如果该字段为空 - 应给出下一个填充的根行页面的项目。
为了获得这些项目,我使用了这样的 DatabaseQueryProcessor。
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
200 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
200 {
table = tx_myext_topofferitem
pidInList = root,-1
recursive = 99
selectFields = tx_myext_topofferitem.*
join = tt_content_tx_topofferitem_mm ON tt_content_tx_topofferitem_mm.uid_foreign = tx_myext_topofferitem.uid
where.data = field:uid
where.intval = 1
where.wrap = tt_content_tx_topofferitem_mm.uid_local=|
orderBy = tt_content_tx_topofferitem_mm.sorting
as = tx_myext_topofferitem_items
}
}
}
我尝试将其用作where.data
,但这不起作用。
levelfield : -1 , uid, slide
(TYPO3 9LTS)
解决方案
看来这里最好使用嵌套数据处理。因此,首先获取一个根行菜单,然后获取属于该菜单特定页面的项目。
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
special = rootline
special.range = 0|-1
special.reverseOrder = 1
as = rootline
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
if.isTrue.field = tx_myext_topofferitem
table = tx_myext_topofferitem
pidInList.field = uid
selectFields = tx_myext_topofferitem.*
join = tt_content_tx_topofferitem_mm ON tt_content_tx_topofferitem_mm.uid_foreign = tx_myext_topofferitem.uid
where.data = field:uid
where.intval = 1
where.wrap = tt_content_tx_topofferitem_mm.uid_local=|
orderBy = tt_content_tx_topofferitem_mm.sorting
as = tx_myext_topofferitem_items
}
}
}
}
}
}
推荐阅读
- django - 保存从表单传递数据的表单集数据
- sorting - 我在统一项目中面临排序问题,数组元素失去了适当的顺序
- javascript - React 中的“TypeError:props.todoList 未定义”
- elasticsearch - elasticsearch 有没有办法将特定的搜索结果重定向到 Context Suggester?
- python - 在 seaborn 子图中旋转所有轴
- java - 在 dbeaver 上选择文本背景“白色”
- sql-server - 删除字符串类型主键并添加新的 Int 主键 - EntityFrameWork Core
- javascript - 来自前端的 Linkedin oauth/v2/accessToken API 上的 CORS 错误
- git - 如何从 git 分支中删除文件夹?
- python - Pytest:输出文件不显示测试/警告摘要