I'm curently developing a (free) Custom Joomla 4.x component. Now im struggeling while implementing Custom Fields support for my first (and currently only) context. The issue is that the "Fields" tab does not get showed in the backend when editing a "location". I've followed the guide by astrid on how to create a component.
It's the third time I create a component for joomla 4 and as far as i can see i've done everything similar to the others i've already created. I did not spot the issue here.
Could please someone check my repo here: GitHub and tell me what i am doing wrong?
thanks for your help
Edit
I've added the mentioned changes (thanks for that) and updated the repo, still no effect on the edit view for a location...
class FootballmanagerComponent extends MVCComponent implements FieldsServiceInterface
...
public function validateSection($section, $item = null)
{
if (Factory::getApplication()->isClient('site') && $section === 'form')
{
return 'footballmanager';
}
if ($section !== 'footballmanager' && $section !== 'form')
{
return null;
}
return $section;
}
public function getContexts(): array
{
Factory::getApplication()->getLanguage()->load('com_footballmanager', JPATH_ADMINISTRATOR);
$contexts = array(
'com_footballmanager.location' => Text::_('COM_FOOTBALLMANAGER_LOCATION'),
// 'com_helloworld.categories' => JText::_('JCATEGORY')
);
return $contexts;
}
What I see when i add fields for this component there is no "category" input in the fields that looks a bit suspicious to me.
preprocessForm()
method so it always calls the parent method.