Finding source of class/methods quickly?

For Joomla! 3.x Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Post Reply
fizznotch
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sat Oct 25, 2008 7:50 pm

Finding source of class/methods quickly?

Post by fizznotch » Sun Apr 15, 2018 5:47 pm

Does anyone have any tips on how to quickly find the file that would contain the class definition of a specific object?

I often find myself wanting to look up the definition of an object to be sure that I know how it is defined, or to learn more about what it does and I would prefer to be able to quickly look through the source code on my wamp development folder.

For example, I am looking at an older component I wrote and want to remind myself what

Code: Select all

JHtml::_('formbehavior.chosen, select')
does. In this case I ended up searching through the 'libraries' directory for a string 'function _(' until I found the right file. I have a feeling that this isn't the most efficient way to find the definition code! :)

I've tried using the api.joomla.com site but that doesn't see to point me back to the correct file in my installation (and I couldn't see how to easily search the api index, or how to view the source code)

Many thanks in advance !
Last edited by toivo on Sun Apr 15, 2018 6:29 pm, edited 1 time in total.
Reason: mod note: moved to 3.x Coding

User avatar
toivo
Joomla! Exemplar
Joomla! Exemplar
Posts: 9608
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK
Contact:

Re: Finding source of class/methods quickly?

Post by toivo » Sun Apr 15, 2018 6:27 pm

There is an application, written in Perl, called PHPXref, available from http:/phpxref.sourceforge.net. It can still be useful, even though it has not been maintained for several years and therefore lacks support for the latest features in OOP.
Toivo Talikka, Global Moderator
my first programs were assembled and run in 16KB :)
troubleshooting smtp and other articles https://talikka.com/joomla

mbabker
Joomla! Hero
Joomla! Hero
Posts: 2176
Joined: Sun Feb 28, 2010 8:26 pm

Re: Finding source of class/methods quickly?

Post by mbabker » Sun Apr 15, 2018 6:37 pm

JHtml is one of those funny beasts. The underscore method is really a proxy loader method to a custom callback based on some other rules (if the string has no dots, it's a method in the JHtml class; in a string with one dot the first segment is prefixed with JHtml to create a new class name (in this case JHtmlFormbehavior) and the second segment the method in that class).

If you're using PhpStorm, it has some inbuilt logic to help resolve that JHtml stuff. Otherwise, most IDEs have some functionality where you can jump direct to the source method. And when all else fails, search works.
So long and thanks for all the fish.

Manually updating Joomla? See https://gist.github.com/mbabker/d7bfb4e ... 3607f89281

fizznotch
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Sat Oct 25, 2008 7:50 pm

Re: Finding source of class/methods quickly?

Post by fizznotch » Sun Apr 15, 2018 8:06 pm

Thanks very much for the quick reply and for the explanation heads up on how the underscore method resolves what to use!

with respect to IDEs , I've been using Sublime Text 3, but I'm just installing eclipse to try that out.


Post Reply

Return to “Joomla! 3.x Coding”