Joomla 3文章自定义模块中的模态表单字段

sun*_*nny 4 article module joomla3.1

我想在我的自定义模块中有一个文章选择器.一个按钮和一个这样的表单字段添加新文章.

有可能吗?我在我的模块xml中试过这个:

                <field name="article_id" type="modal_article" default="" label="Select an article" description="" />        
Run Code Online (Sandbox Code Playgroud)

但我只获得表单输入,而不是选择文章的按钮.

moz*_*ami 7

您需要手动将路径添加到模态文章元素.在modal_article字段类型正上方的<fieldset>元素中,添加以下属性:

 addfieldpath="/administrator/components/com_content/models/fields"
Run Code Online (Sandbox Code Playgroud)

所以你的最终xml看起来像这样:

<fieldset name="basic" addfieldpath="/administrator/components/com_content/models/fields">
<field name="article_id" type="modal_article" default="" label="Select an article" description="" />
Run Code Online (Sandbox Code Playgroud)