1

I Have a plugin and I have the Following code working fine:

if ($this->params->get('thepath') == 'plugins'){

       JForm::addFormPath(JPATH_PLUGINS.'/system/add_xml_fields/');

      }

I need to load the actual default template path and your overrides, like this:

if ($this->params->get('thepath') == 'template_override'){
        foreach ($themodules as $key=>$themodule){
            if ($data->module==$themodule) {
                JForm::addFormPath($tpath.'html'.$themodule.'/');
            }
        }
    }

How can I make this to work. Actually do not load anything :(

1

Solved, using a database query like this bellow:

if ($this->params->get('thepath') == 'template_override'){
foreach ($themodules as $key=>$themodule){
    if ($data->module==$themodule) {
        $db = JFactory::getDBO();
        $query = "SELECT template FROM #__template_styles WHERE client_id = 0 AND home = 1";
        $db->setQuery($query);
        $defaultemplate = $db->loadResult();
        JForm::addFormPath( JPATH_SITE.'/templates/'.$defaultemplate.'/html/'.$themodule.'/');
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.