<p>Presented as an alternative to <a href="https://github.com/joomla/joomla-cms/pull/3091" class="issue-link" title="Load component params">#3091</a>, as suggested by <a href="https://github.com/radiant-tech" class="user-mention">@radiant-tech</a>, we shall never include component params in menu item configs. </p>
⇒
<p>Presented as an alternative to <a href="https://github.com/joomla/joomla-cms/pull/3091" class="issue-link" title="[#33264] Load component params">#3091</a>, as suggested by <a href="https://github.com/radiant-tech" class="user-mention">@radiant-tech</a>, we shall never include component params in menu item configs. </p>
There's not really anything to test here. I'm removing this non-functioning block of code:
// Now load the component params.// TODO: Work out why 'fixing' this breaks JFormif($isNew=false){$path=JPath::clean(JPATH_ADMINISTRATOR.'/components/'.$option.'/config.xml');}else{$path='null';}if(is_file($path)){// Add the component params last of all to the existing form.if(!$form->load($path,true,'/config')){thrownewException(JText::_('JERROR_LOADFILE_FAILED'));}}
Obviously, this always sets $path to null and then doesn't try to load it because is_file(null) is definitely false. So this code does nothing and the thing it was supposed to do probably shouldn't be done anyway.
By the way, the reason $form->load($path, true, '/config') wasn't working is because that function takes xml data, not a path to an xml file. The function that should have been used was loadFile but we probably don't want the component params here anyway so just remove it all.
There's not really anything to test here. I'm removing this non-functioning block of code:
Obviously, this always sets
$path
tonull
and then doesn't try to load it becauseis_file(null)
is definitely false. So this code does nothing and the thing it was supposed to do probably shouldn't be done anyway.By the way, the reason
$form->load($path, true, '/config')
wasn't working is because that function takes xml data, not a path to an xml file. The function that should have been used wasloadFile
but we probably don't want the component params here anyway so just remove it all.