Another weird issue in one of my comppnents i did not understand. I have implemented custom categories by using com_component.teams and com_component.locations - Additionally. it works all fine until i add Custom Field Support to my items. When Fields has been added to a stuff or a things item icannot longer switch the category of this element. the Joomla loading icon shows up (as usual for updating the fields for the new category) but then it falls back to the same category that was selected before. It looks like the Userstate does not get updated all changes that has been made are lost.
My Field for category selection in the location edit (catid):
<field
name="catid"
type="categoryedit"
label="JCATEGORY"
extension="com_component.locations"
addfieldprefix="Joomla\Component\Categories\Administrator\Field"
required="true"
default=""
/>
In my extension.php:
public function validateSection($section, $item = null)
{
// when printed here $section is correct location or team //
if (($section === 'location')) {
$section = 'location';
}
if (($section === 'team')) {
$section = 'team';
}
if ($section !== 'project' && $section !== 'client') {
return null;
}
return $section;
}
...
public function getContexts(): array
{
Factory::getApplication()->getLanguage()->load('com_footballmanager', JPATH_ADMINISTRATOR);
$contexts = array(
'com_component.location' => Text::_('COM_COMPONENT_LOCATION'),
'com_component.team' => Text::_('COM_COMPONENT_TEAM')
)
return $context;
}
Another thing I've identified is that when switching the context in the com_fields view the context is correct BUT the url shows wrong context / a different one... like "context=component.game" when Location is selected and vice versa (there are more so its different but always the same wrong context in url)
I have no clue where to start at... Link to the Github Repo: https://github.com/marcorensch/com_footballmanager_2
public function validateSection($section, $item = null) { return in_array($section, ['location', 'team', 'project', 'client'], true) ? $section : null; }
?