Closed Elfangor93 closed 6 months ago
An error message appears when saving a category or an image: _Error deriving settings from configurations. Provided context may be wrong. Context: comjoomgallery. But the category or image is saved normally.
I tried to include the fields in the menu item for the category view and to display the value from the configuration with Use global. It works quite well. The respective value is displayed 👍
However, the following message always appears when opening the menu entry:
Error: Configuration Set not properly loaded.
The message is generated here in the DefaultConfig.php file:
//---------Level 3---------
if(isset($this->ids['category']) && $this->ids['category'] > 1)
{
// Load parent categories
$cat_model = $this->component->getMVCFactory()->createModel('Category', 'administrator');
$parents = $cat_model->getParents($this->ids['category'], true);
if($parents === false && empty($parents))
{
$this->app->enqueueMessage(Text::_('COM_JOOMGALLERY_SERVICE_ERROR_LOAD_CONFIG'), 'error');
return;
}
However, the following message always appears when opening the menu entry:
Should be fixed now...
I have tested this item ✅ successfully. Thank you very much.
This PR adds form fields for configuration params that are inherited through the component global config sets, categories, images, menu items.
The following field types are added:
jglist (for selections) Dropdown list with first entry beeing "Use Global (value)"![grafik](https://github.com/JoomGalleryfriends/JG4-dev/assets/39154009/c25231fd-3303-4c26-a043-6558ac97d9eb)
jgradio (for yes, no selections) Three radio buttons with first button beeing "Use Global (value)"![grafik](https://github.com/JoomGalleryfriends/JG4-dev/assets/39154009/905b445c-c7f8-4f92-ad9d-a8330cc86ac7)
jgtext (for free text input) Text field with hint beeing the global value![grafik](https://github.com/JoomGalleryfriends/JG4-dev/assets/39154009/cbd7bf42-4258-4b52-a4bc-8001718b9557)
jgnumber (for number input) Number field with hint beeing the global value![grafik](https://github.com/JoomGalleryfriends/JG4-dev/assets/39154009/9a47bd0b-2863-4335-a466-ec9ff7b4ba51)
Adding field to XML form
If you want the global inherited value to be calcultaed and displayed, its important to add the
useglobal="true"
attribute to the field definition in the XML.Attention! If you want to use this fields in XML forms outside the joomgallery component, for example in a menu item form, its important that the
addfieldprefix="Joomgallery\Component\Joomgallery\Administrator\Field"
attribute is set in the form or fieldset you will use the field.How to test this PR
The parameter fields in the image and category form view should work the same as before.