terminal42 / dcawizard
dcaWizard 扩展,适用于 Contao 开源 CMS
3.0.3
2024-04-17 14:02 UTC
Requires
- php: ^8.1
- ext-json: *
- codefog/contao-haste: ^4.0 || ^5.0
- contao/core-bundle: ^4.13 || ^5.0
- doctrine/dbal: ^3
Requires (Dev)
- contao/manager-plugin: ^2.0
- terminal42/contao-build-tools: dev-main
Conflicts
- contao/manager-plugin: <2.0 || >=3.0
README
此扩展提供了一个小部件,用于处理父记录编辑模式中的外部表记录。
如何使用
// DCA defnition 'prices' => array ( 'inputType' => 'dcaWizard', // Define the foreign table 'foreignTable' => 'tl_iso_prices', // Define the foreign field (e.g. fid instead of pid) 'foreignField' => 'fid', // Use the callback to determine the foreign table 'foreignTable_callback' => array('tl_iso_prices', 'getTableName'), // Add special params to the link of the button 'params' => [ // Change the do parameter 'do' => 'member', // Add new parameter, for example to filter the list 'filterField' => 'group', ], 'eval' => [ // A list of fields to be displayed in the table 'fields' => array('id', 'name', 'alias'), // Header fields of the table (leave empty to use labels) 'headerFields' => array('ID', 'Name', 'Alias'), // Use a custom label for the edit button 'editButtonLabel' => $GLOBALS['TL_LANG']['tl_iso_products']['prices_edit_button'], // Set a label if no records are found 'emptyLabel' => $GLOBALS['TL_LANG']['tl_iso_products']['prices_empty_label'], // Order records by a particular field 'orderField' => 'name DESC', // Hide the popup button (record list functionality only) 'hideButton' => true, // Show operations next to every row (disabled by default) 'showOperations' => true, // Define which operations you want to list // If this one is not defined, are all listed 'operations' => ['edit', 'delete', 'new' /* for tables with sorting like tl_content */], // Define which global operations you want to add 'global_operations' => ['new'], // Use your own custom template 'customTpl' => 'be_widget_dcawizard_mytemplate', // Use the callback to generate the list 'list_callback' => ['Isotope\tl_iso_prices', 'generateWizardList'], ], ), // Example list callback: /** * Generate a list of prices for a wizard in products * @param object * @param string * @return string */ public function generateWizardList($objRecords, $strId) { $strReturn = ''; while ($objRecords->next()) { $strReturn .= '<li>' . $objRecords->name . ' (ID: ' . $objRecords->id . ')' . '</li>'; } return '<ul id="sort_' . $strId . '">' . $strReturn . '</ul>'; }
结合 DC_Multilingual 使用 dcaWizard
如果您想使用 dcaWizard 来管理由 DC_Multilingual 生成的外部表,您可以直接使用
'inputType' => 'dcaWizardMultilingual',
因此,翻译条目将不会列出。
如果您没有使用 language
数据库列来分离条目(请参阅 DC_Multilingual
中的 langColumn
设置),您也可以在 eval
部分中指定匹配的列名
'eval' => [ 'langColumn' => 'language_column_name', ], )