Groups
Groups
Sign in
Groups
Groups
Joomla! General Development
Conversations
About
Send feedback
Help
Factory::getApplication()->getMenu() deprecated
229 views
Skip to first unread message
Bernhard Woehrlin
unread,
Oct 7, 2021, 2:17:31 PM
10/7/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Joomla! General Development
I am used to get the current item id like this:
$itemId = Factory::getApplication()->getMenu()->getActive()->id;
In Joomla 3.10 Factory::getApplication()->getMenu() seems to be deprecated. How should I rewrite the code to get the current item id?
Carlos Rodríguez
unread,
Oct 7, 2021, 9:03:05 PM
10/7/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Joomla! General Development
No, still the same, even for J4, and is not deprecated:
$app = Factory::
getApplication
();
$itemId = $app->
getMenu
()->
getActive
()->id;
Bernhard Woehrlin
unread,
Oct 8, 2021, 7:11:43 AM
10/8/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Joomla! General Development
Hm. Maybe I misinterpret the API documentation?
https://api.joomla.org/cms-3/classes/JApplication.html#method_getMenu
Carlos Rodríguez
unread,
Oct 8, 2021, 10:36:24 AM
10/8/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Joomla! General Development
Check here this method, and you will understand:
https://github.com/joomla/joomla-cms/blob/e35eaaa36e20989f624413c4a1269cc5eb1cdc12/libraries/src/Application/CMSApplication.php#L502
Reply all
Reply to author
Forward
0 new messages