Code PHP:
public function checkFormDependComponent()
{
$app = JFactory::getApplication();
$pluginName = $this->getPlugin('element');
$pluginNameId = $this->getPlugin('extension_id');
$manifest = JPATH_SITE.DS.'plugins'.DS.'jfcore'.DS.$pluginName.DS.$pluginName.'.xml';
jimport('joomla.form.form');
$form = JForm::getInstance('plg_jfcore_'.$pluginName, $manifest, array(), true, 'component');
$xml = $form->getXml();
$components = $xml->component;
foreach($components as $component)
{
$com = (string)$component->attributes();
if ( !JComponentHelper::isEnabled($com) )
{
if( JRequest::getVar('option') == "com_plugins" && JRequest::getVar('view') == "plugin" && JRequest::getVar('extension_id') == $pluginNameId){
JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_JFCORE_JFCORE_COMPONENT_DISABLED', $com, $com), 'Notice');
}
$componentForms['components']['disabled'][] = $com;
}
else
{
$componentForms['components']['enabled'][] = $com;
}
}
foreach($componentForms['components']['enabled'] as $componentForm)
{
$name = $componentForm;
$validForm = JForm::getInstance('plg_jfcore_'.$pluginName.'_'.$name, $manifest, array(), true, 'component[@name="'.$name.'"]');
foreach ($validForm->getFieldset() as $field)
{
$render = $field->renderField();
}
}
//echo '<pre>' .print_r( $html ,true). '</pre>';
}
Code PHP:
<component name="com_k2" label="Saisons">
<field name="com_k2" label ="com_k2" type="editor" width="100%" filter="safehtml" buttons="true"></field>
</component>
<component name="com_content" label="Saisons">
<field name="com_content" label ="com_content" type="editor" width="100%" filter="safehtml" buttons="true"></field>
</component>
<component name="tortags" label="Saisons">
<field name="tortags" label ="tortags" type="editor" width="100%" filter="safehtml" buttons="true"></field>
</component>
<component name="com_lol" label="Saisons">
<field name="com_lol" label ="com_lol" type="editor" width="100%" filter="safehtml" buttons="true"></field>
</component>
Commentaire