You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to use FormModelInterface::getForm() method outside of a component execution. Because FormBehaviorTrait::loadForm() uses JPATH_COMPONENT constant to register paths to form object. This results in a could not load file error when trying to load form on a page where desired component is not loaded or in cli/scheduled task. I consider it a bug as component booting doesn't apparently boot the component fully.
// Get the form.Form::addFormPath(JPATH_COMPONENT . '/forms');
Form::addFormPath(JPATH_COMPONENT . '/models/forms');
Form::addFieldPath(JPATH_COMPONENT . '/models/fields');
Form::addFormPath(JPATH_COMPONENT . '/model/form');
Form::addFieldPath(JPATH_COMPONENT . '/model/field');
I would propose to register those paths in Joomla\CMS\MVC\Factory\MVCFactory::createModel() method to avoid issues when component is booted outside of component execution.
The text was updated successfully, but these errors were encountered:
Steps to reproduce the issue
Unable to use
FormModelInterface::getForm()
method outside of a component execution. BecauseFormBehaviorTrait::loadForm()
usesJPATH_COMPONENT
constant to register paths to form object. This results in acould not load file
error when trying to load form on a page where desired component is not loaded or in cli/scheduled task. I consider it a bug as component booting doesn't apparently boot the component fully.Expected result
Form is being loaded.
Actual result
could not load file
errorSystem information (as much as possible)
Joomla 4.x, 5.x and 6.x
Additional comments
The root of this problem is this part in line 73 of https://github.com/joomla/joomla-cms/blob/4.4-dev/libraries/src/MVC/Model/FormBehaviorTrait.php
I would propose to register those paths in
Joomla\CMS\MVC\Factory\MVCFactory::createModel()
method to avoid issues when component is booted outside of component execution.The text was updated successfully, but these errors were encountered: