Functions and Methods where are they?

Functions and Methods where are they?

από Linda Russell -
Αριθμός απαντήσεων: 8

I am new to Moodle  Development. Whilst I can work out what functions  are doing I cannot find where some of the first ones used are defined, e.g  my_site(), instance(). I can find others. Any help greatly appreciated please. Falling at the first hurdle! Many Thanks

Μέσος όρος βαθμολογίας: -
Σε απάντηση σε Linda Russell

Re: Functions and Methods where are they?

από Michael Aherne -
Φωτογραφία Core developers Φωτογραφία Particularly helpful Moodlers Φωτογραφία Peer reviewers Φωτογραφία Plugin developers

Hi Linda, are you using some kind of IDE to look at the code? If not, you should, as it's much easier to navigate through. We use Eclipse, for example, which allows you to press F3 in a function name and be taken to the function definition. Other IDEs that have this kind of functionality are Netbeans and PHP Storm. PHP Storm has a cost associated with it but the other two are free.

Σε απάντηση σε Linda Russell

Re: Functions and Methods where are they?

από Davo Smith -
Φωτογραφία Core developers Φωτογραφία Particularly helpful Moodlers Φωτογραφία Peer reviewers Φωτογραφία Plugin developers

This is something any reasonable IDE should be able to handle for you.

I use PHPStorm, which allows you to hold Ctrl and click on the name of the function, to be taken directly to the function definition.

I assume that Eclipse, Netbeans and other IDEs have similar functionality.


Σε απάντηση σε Davo Smith

Re: Functions and Methods where are they?

από Marcus Green -
Φωτογραφία Core developers Φωτογραφία Particularly helpful Moodlers Φωτογραφία Plugin developers Φωτογραφία Testers

Netbeans has a similar feature. In theory PHPStorm has better debugging (certainly than Netbeans), but I have never been able to get it to work.

Σε απάντηση σε Marcus Green

Re: Functions and Methods where are they?

από Linda Russell -

I have installed eclipse and it works very well. All you do is hover over the function, the script explaining what the function does appears (very useful) and then if you hold down shift the function underlines and you can click it and go to where the function is defined. Made the task of understanding Moodle much easier. So grateful for the advice.

Σε απάντηση σε Linda Russell

Re: Functions and Methods where are they?

από Yousuf Tafhim -
Using an IDE (PHPStorm, NetBeans etc.) is preferred.
However, you can do the same with using Sublime Text as well. You will need to install Package Control and then install SublimeCodeIntel.
After save the Moodle folder as a project. No whenever you will open the file and hover over any function/method you will see its definition and usage.
You can also use Moodle project on Github. Just go there and search the function/method and it will show all the matched in the repository.