I need to display links of a custom component on breadcrumbs. How can i get it done?
Example my component (site part) has the following url:
site.com/gallery/animals/
where animals
is the URL of the component and gallery
is the menu item alias
My breadcrumb shows:
home/gallery
instead of home/gallery/animals
UPDATE
The "problem" lies in modules/mod_breadcrumbs/helper
specifically in the getPathWay()
method; It returns the path but not including the url of the component. The print_r
function gave me:
Joomla\CMS\Pathway\SitePathway Object ( [_pathway:protected] => Array ( [0] => stdClass Object ( [name] => Gallery [link] => index.php?option=com_galley&view=gallery&Itemid=361 ) ) [_count:protected] => 1 )
where index.php?option=com_galley&view=gallery&Itemid=361
is the url of the menu item; it should have given me (i expected it at least) something like this:
Joomla\CMS\Pathway\SitePathway Object ( [_pathway:protected] => Array ( [0] => stdClass Object ( [name] => Gallery [link] => index.php?option=com_galley&view=galler&Itemid=361 ) [link] => &view=gallery&Itemid=91 ) ) [_count:protected] => 1 )
where &view=gallery&Itemid=91
would be my component url.
Is there any way to add the url of custom component to the getPathWay()
method?
UPDATE
I found a method to add an item to the pathway; the method is addItem(string $name, string $link)
Something like this:
$app= JFactory::()->getApplication();
$pathway=$app->getPathWay();
$pathway->addItem('Animals' , 'animals');
it works but now i need a way to automatically get it from the URL and add it to the method addItem()