如何在编辑器xtd插件模式窗口中使用JForm字段

问题描述:

我成功地将我的joomla 3图库模块转换为joomla 3插件,并创建了一个编辑器-xt插件,在模式窗口中打开文件settings.php。如何在编辑器xtd插件模式窗口中使用JForm字段

在这个窗口的body标签中,我想使用与模块的我的清单xml文件中相同的xml Form字段。

<form> 
<fieldset name="catid" addfieldpath="/plugins/editors-xtd/gallery/fields/"> 
     <field 
      name="gallery-category" 
      type ="gallerycategory" 
      label="Gallery cat id" 
      description="Gallery cat id" 
      default = "0" 
     /> 
</fieldset> 

有没有办法让这个PHP文件的主体呈现的XML表单字段?

在周末我设法加载我自己的settings.xml文件,并在php模式中显示一个选择框。

<?php 

    define('_JEXEC', 1); 
    define('DS', DIRECTORY_SEPARATOR); 
    define('JPATH_BASE', realpath('..'.DS.'..'.DS.'..'.DS)); 
    require_once (JPATH_BASE.DS.'includes'.DS.'defines.php'); 
    require_once (JPATH_BASE.DS.'includes'.DS.'framework.php'); 


    $xmlPath = dirname(__FILE__) .'/forms/settings.xml'; 

    jimport('joomla.form.form'); 
    $form = JForm::getInstance('idform', $xmlPath); 

?> 
<html> 
    <head> 
     <title>titel</title> 
     <meta http-equiv="content-type" content="text/html;charset=utf-8" /> 
     <link rel="stylesheet" href="../../../administrator/templates/isis/css/template.css" type="text/css" /> 
     <script type="text/javascript"> 
      function insertCatId() { 
       var codeInsert = document.getElementById("settings_category").value; 
       var tag = "{category:"+codeInsert+"}"; 
       window.parent.jInsertEditorText(tag, ' . json_encode($this->eName) . '); 
       window.parent.jModalClose(); 
       return false; 
      } 
     </script> 
    </head> 
    <body> 
    <div> 
     <fieldset> 
     <form name="idform"> 
      <div class="control-group"> 
       <div class="control-label"> 
        <p>&nbsp;</p> 
        <label>Insert category id</label> 
       </div> 
       <div class="controls"> 
        <?php echo $form->getInput('category', 'settings'); ?> 
       </div> 
      </div> 
     </form> 
     </fieldset> 
     <button onclick="insertCatId();" class="btn btn-success"><?php echo JText::_('Insert'); ?></button> 
    </div> 
    </body> 
</html> 

<?php echo $form->getInput('category', 'settings'); ?> 

呈现一个标准选择框,但不是典型的Joomla输入框与建议和自动完成功能。我如何实现这一目标?