If you create a component with multiple categories for example:
JHtmlSidebar::addEntry(
JText::_('COM_HELLOWORLD_CAT1'),
'index.php?option=com_categories&extension=com_helloworld.cat1',
$vName == 'categories'
);
JHtmlSidebar::addEntry(
JText::_('COM_HELLOWORLD_CAT2'),
'index.php?option=com_categories&extension=com_helloworld.cat2',
$vName == 'categories'
);
When Joomla\CMS\Table\Category::_getAssetParentId tries to find the parent asset it will fail as there is no com_helloworld.cat1 asset in the assets table. It should instead try to find the component asset com_helloworld.
It should get the default ACL from the component asset.
It get is ACL from the root asset.
Joomla 3.8.1
PHP 7.1.1
MySQL 5,7
This could easily be fixed by exploding $this->extension and only use the first part in
joomla-cms/libraries/src/Table/Category.php
Line 109 in c343565
Labels |
Added:
?
|
Category | ⇒ | ACL com_categories |
Status | New | ⇒ | Information Required |
They get the parent id of 1, so the root asset object.
So thats the problem - you need to give them the parent id of the component. See the assets for com_content for an example
Every time you save it, it reset to the root asset as it cannot find the component as the parent.
You need to understand its not like the com_content as com_content does not use two categories in one component.
Check the code in Joomla\CMS\Table\Category::_getAssetParentId and you will understand the problem.
As there is no com_helloworld.cat2 in the asset table it will always fallback to the root asset.
Even com_fields have fixed this
Status | Information Required | ⇒ | Discussion |
Labels |
Added:
J3 Issue
|
Status | Discussion | ⇒ | Information Required |
Thank you for raising this issue.
Joomla 3 is now in security only mode with no further bug fixes or new features.
As this issue doesn't relate to Joomla 4 it will now been closed.
If we are mistaken and this does apply to Joomla 4 please open a new issue (and reference this one if you wish) with updated details for testing in Joomla 4.
cc @zero-24
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-08-23 13:47:58 |
Closed_By | ⇒ | zero-24 | |
Labels |
Added:
No Code Attached Yet
Removed: ? |
In your asset table do the two categories have a parent id?