我需要将 Joomla 3.9.13(后端)中子表单的管理 TableView 更改为(已经存在的)div 模式。 我可以通过更改以下代码来做到这一点:
plugins/fields/repeatable/repeatable.php 第 52 行
改变:
$fieldNode->setAttribute('layout', 'joomla.form.field.subform.repeatable-table');
致:
$fieldNode->setAttribute('layout', 'joomla.form.field.subform.repeatable');
这是一个核心修改。那么如何在不修改核心文件的情况下实现这一目标呢?
最佳答案
子表单字段类型有一个默认功能,允许您选择布局。
layout (optional) the name of the layout to use when displaying subform fields. Available layouts:
joomla.form.field.subform.default render the subform in a div container, without support of repeating. Default for single mode.
joomla.form.field.subform.repeatable render the subform in a div container, used for multiple mode. Support groupByFieldset.
joomla.form.field.subform.repeatable-table render the subform as a table, used for multiple mode. Supports groupByFieldset. By default each field is rendered as a table column, but if groupByFieldset=true then each fieldset is rendered as a table column.
您需要在表单 xml 文件中更新此文件,该文件位于/models/forms/viewname.xml
<field
name="field-name"
type="subform"
label="Subform Field"
layout="joomla.form.field.subform.repeatable"
/>
关于joomla3.0 - 如何将子表单的 (Joomla) 管理布局从表格模式更改为 div 模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58803418/