We add a setting to our block here and then read that in the code and use it to change the behaviour. We display a list of courses instead of users when it's enabled.
We use the core moodle function get_config() to read in the config from our block. We don't want to have to do a direct DB query for something like that.
Code is here: https://github.com/kristian-94/moodle-block_testblock
Get the full course on Udemy: https://www.udemy.com/course/moodle-developer-course/?referralCode=117EAE3796C1BA840895
or skillshare: https://skl.sh/3deuyuv
There is heaps more moodle stuff I want to show so I should be back soon with a lot more content and tutorials.
For custom development work, one on one training, or Moodle hosting, get in touch with us over at https://ringertech.org/contact
Download
0 formats
No download links available.
Moodle developer tutorial 5/5 - adding a setting to our new block and use that in the code | NatokHD