I am trying to extend the xml field parameters of my module (and also the same for my content plugin) with specific external plugin, I have found this how-to, who works well under J1.5, especially the adaptation solution to the module :
http://www.teachmejoomla.net/code/jooml ... ugins.html
but i don't succeed under J2.5.
here is my module.php
Code: Select all
// Include the syndicate functions only once
require_once dirname(__FILE__).DS.'helper_plugin.php';
class JFormFieldModule extends JFormField
{
public $type = 'MenuItems';
protected function getInput()
{
$db =& JFactory::getDBO();
$id = JRequest::getVar( 'id', 0, '', '' );
$cid = JRequest::getVar( 'cid', array($id), 'method', 'array' );
JArrayHelper::toInteger($cid, array(0));
$query = 'SELECT params FROM #__modules WHERE id='. $cid[0];
$db->setQuery($query);
$params = $db->loadResult();
return mymodulePluginsHelper::getPluginParams($params);
}
}
Code: Select all
/** ensure this file is being included by a parent file */
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' );
class mymodulePluginsHelper {
function getPluginParams( $params ) {
$return = null;
// set the plugins path
$plugins_path = JPATH_ROOT . DS . 'modules' . DS . 'mymodule' . DS . 'includes' . DS . 'plugins';
// load the xml config plugins
$files = JFolder::files( $plugins_path , "^(.*)?\.xml" , false , true);
//load the xml config plugins in the module config
if ( count( $files ) ) {
foreach ( $files as $key => $path ) {
//load xml paremeters
$myparams = new JParameter( $params , $path );
// return html
$params_html = $myparams->render();
//clean html for rendering
$params_html = substr( $params_html , 0 , -8 );
$params_html = substr( $params_html , 65 );
//load in return
$return .= $params_html;
$myparams = null;
}
}
return $return;
}
}
Code: Select all
<config>
<fields name="params">
<fieldset name="test">
<field name="" type="module" default="" addfieldpath="/modules/mymodule/includes/fields"/>
</fieldset>
<fieldset name="another_fileds">
<field name="test" type="spacer" default="" />
<field name="mod_test" type="list" default="0" label="test" description="desc test">
<option value="0">Option 1</option>
<option value="2">Option2</option>
</field>
</fieldset>
</fields>
</config>
Code: Select all
<config>
<fieldset name="extend">
<field name="extend desc" type="spacer" default="" />
<field name="extendtext1" type="text" default="" label="extend text1" description="desc extendtext1" size="70" />
<field name="extendtext2" type="text" default="" label="extend text1" description="desc extendtext1" size="70" />
</fieldset>
</config>
The result in the backend is a warning :
Code: Select all
COM_MODULES_test_FIELDSET_LABEL
Notice: Undefined property: JSimpleXMLElement::$params in D:\test\Site web\test25\libraries\joomla\html\parameter.php on line 398