我是 Joomla 编程新手。我已经构建了一个插件,并且运行良好。我只有一个小烦恼,让我一整天都快发疯了。当您进入后端配置插件时,选项会偏移 180px 的左边距。我发现这是因为选项被包装在一个 div 中,其样式为“control-group”,应用了此边距。
为了更好地理解问题,以下是输出的浓缩版:
<div class="control-group">
<div class="control-label">
<label id="jform_params_group_template_mapping-lbl" for="jform_params_group_template_mapping" class="hasTooltip" title="" data-original-title=""></label>
</div>
<div class="controls">
//This is where my generated code is
<div class="control-group">
<div class="control-label">
<label>Uncategorised</label>
</div>
<div class="controls" style="float:right;margin-right:20%;">
</div>
</div>
<div class="control-group">
<div class="control-label">
<label>Blog</label>
</div>
<div class="controls" style="float:right;margin-right:20%;">
</div>
</div>
<div class="control-group">
<div class="control-label">
<label>TestingTemplate</label>
</div>
<div class="controls" style="float:right;margin-right:20%;">
</div>
</div>
</div>
</div>
如您所见,我的控件都在一个控件内。我似乎无法找到带有类控制组的父 Div 的来源。我更希望我生成的内容有自己的控件,而不是子 div。
请告诉我您需要查看代码的哪一部分来帮助我确定此问题。我觉得它是 list XML 的一部分,但我是 Joomla 的新手。
list 文件的配置部分是:
<config>
<fields name="params">
<fieldset name="basic">
<field type="fta.mapping" name="group_template_mapping" addfieldpath="/plugins/system/assigntemplatebycategory/fields" description="PLG_SYSTEM_TEMPLATE_ASSIGNER_GROUP_TEMPLATE_MAPPING_DESC" label="PLG_SYSTEM_TEMPLATE_ASSIGNER_GROUP_TEMPLATE_MAPPING_LABEL" default=""/>
</fieldset>
</fields>
</config>
最佳答案
配置文件结构正确。但是很不寻常,因为 addfieldpath 通常是在字段级别定义的,而不是单个字段,即
<config>
<fields addfieldpath="/administrator/components/com_littlehelper/elements/" name="params">
我不确定这是否会成为问题。
问题很可能出在自定义字段上。要进行测试,只需将字段类型更改为 text
并查看是否出现不需要的缩进。如果是这样,/plugins/system/assigntemplatebycategory/fields/fta.mapping.php
中定义的自定义字段输出应该包含一个额外的包装器。
同时尝试将 addfieldpath
属性移动到 fields
(并将其从 field
中删除)。
关于html - Joomla 插件后端选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21070319/