Developing Custom Module Like Label

Developing Custom Module Like Label

Hamza Khan -
回帖数:4

Hi ! 
I am trying to develope a custom module like label but with some additional fields. I have done most of the part but I am unable to display certian fields on the course view page I have tried the following instructions to override the stated methods but still unsuccessful.

Moodle version : 3.7


回复Hamza Khan

Re: Developing Custom Module Like Label

Mark Johnson -
Core developers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

Hi Hamza, Support for Moodle 3.7 has ended, so I would suggest you upgrade. It's difficult for the community to provide help with old releases of Moodle, since they may be subject to bugs which are fixed in current versions.

Regarding your specific question, it's hard to say what the problem is without seeing your code. Please provide a link to your code in a public repository on a site like GitHub or GitLab so that other developers can see what you have done so far, and suggest what changes you might need ot make.

回复Hamza Khan

Re: Developing Custom Module Like Label

Séverin TERRIER -
Documentation writers的头像 Particularly helpful Moodlers的头像 Testers的头像 Translators的头像
Hi,

I would say that, before developping something, you should always describe precisely what you want to achieve.

Because perhaps there is already something existing that can answer your needs, using Moodle core tools, or existing plugins.

And at least, sometimes someone will point you to something you can take, and update to add what you need.

For exemple, the Unilabel plugin comes to my mind, but not sure it answers your needs.

Séverin
回复Séverin TERRIER

Re: Developing Custom Module Like Label

AL Rachels -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像
Might also be able to achieve what the OP wants by using the Generico filter in a regular Moodle label.
回复Hamza Khan

Re: Developing Custom Module Like Label

Mark Sharp -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像

If you're looking to add content in the course page, like label, and like folder (which displays a tree of the folder), the function you need to implement is `yourpluginname_get_coursemodule_info` in your plugin's `lib.php` file.

See https://github.com/moodle/moodle/blob/8af7bec81e8da777c3895c7eecaf84dffd24c6be/mod/folder/lib.php#L403

After that, it's down to you to fetch the data you require and output it.