Сделал модуль с формой Repeatable form field type
Повторил все как написано в документации
Ссылка на документацию(https://docs.joomla.org/Repeatable_form_field_type)
Example XML Definition
Code: Select all
<field name="list_templates"
type="repeatable"
icon="list"
description="PLG_TINY_FIELD_TEMPLATE_FIELD_ELEMENTS_DESC"
label="PLG_TINY_FIELD_TEMPLATE_FIELD_ELEMENTS_LABEL"
default='{"template":["Layout","Simple snippet"],
"location":["layout1.html","snippet1.html"],
"description":["HTMLLayout","Simple HTML snippet"]}'>
<fieldset hidden="true" name="list_templates_modal" repeat="true">
<field name="template"
label="PLG_TINY_FIELD_TEMPLATE_FIELD_NAME_LABEL"
size="30"
type="text" />
<field name="location"
label="PLG_TINY_FIELD_TEMPLATE_FIELD_LOCATION_LABEL"
description="PLG_TINY_FIELD_TEMPLATE_LOCATION_DESC"
size="30"
type="filelist"
directory="media/editors/tinymce/templates"
exclude="index.html"
hide_default="true"
hide_none="true" />
<field name="description"
label="PLG_TINY_FIELD_TEMPLATE_FIELD_DESCRIPTION_LABEL"
size="30"
type="textarea" />
</fieldset>
</field>
Code: Select all
// get the repeatable field value and decode it
$list_hosts = json_decode( $params->get('list_templates'),true);
// loop your result
foreach( $list_templates as $list_templates_idx => $list_template ) {
// do something clever for each of the templates
}
Проблема в том что переменная $list_templates пустая, в чем может быть причина? и как ее решить?