[英]Typo3 Extbase filter by sys category
您好,我為我的extbase擴展啟用了類別
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable
工作正常,但是如何過濾要在前端顯示的元素,以便后端用戶可以為插件元素選擇類別?
添加一個FlexForm。 為此,請將其添加到您的ext_tables.php中
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Vendor.' . $_EXTKEY,
'Pluginname',
'My plugin description as shown to the backend user'
);
$pluginSignature = strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY)) . '_pluginname';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/myflexform.xml');
配置flexform,以便您可以選擇一個類別:
<T3DataStructure>
<sheets>
<settings>
<ROOT>
<TCEforms>
<sheetTitle>Settings</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.myCategory>
<TCEforms>
<label>Category</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>sys_category</allowed>
<foreign_table>sys_category</foreign_table>
<size>1</size>
<minitems>0</minitems>
<maxitems>1</maxitems>
</config>
</TCEforms>
</settings.myCategory>
</el>
</ROOT>
</settings>
</sheets>
</T3DataStructure>
請參閱此處以供參考: https : //docs.typo3.org/typo3cms/CoreApiReference/DataFormats/T3datastructure/Index.html
然后在控制器操作中使用該值,例如$this->settings['myCategory']
並將其傳遞到存儲庫中的查詢中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.