This is a more question than an issue report.
With the new RouterViewConfiguration we can set sef url parent section in the following way:
$category = new RouterViewConfiguration('category');
... ...
$this->registerView($category);
$foo = new RouterViewConfiguration('foo');
$foo->setKey('id')->setParent($category, 'catid');
$this->registerView($foo);
Everything is fine.
But how can we setParent, depending on differenct cases? For example, the item foo can be accessed from different parent view "category" and "tag":
index.php?option=com_foo&view=foo&id=1&catid=1
index.php?option=com_foo&view=foo&id=1&tagid=1
We would like to:
if url parameter catid exists: $foo->setParent($category, 'catid');
if url parameter tagid exists: $foo->setParent($tag, 'tagid');
Is it possible in Joomla 4? In Joomla 3 we can do it easily.
PS: Here we don't care about the advantage of SEO unique URL etc.
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
?
|
Ok thanks for your reply. Actually the router which I mentioned above was the old buildRoute / parseRoute from Joomla 2.5 and compatible with Joomla 3. You are right, in Joomla 3 it is almost identical.
The code in J4 is basically identical to J3, so what works there should also work in J4. However, in general you can not define several parents for the same view. The views create a tree-based hierarchy. One view can have several child-views, but always only one parent view. I was just about to say that you could register the same view with 2 different viewconfiguration objects, but actually that currently is not possible. We could add that by adding an alias to the viewconfiguration object, but that most likely wouldn't come before Joomla 5.0.