We will now add some real functionality to our block by adding the ability to configure what the block will display. This is done by adding another function to the block class. Moodle makes it very simple to add this functionality. With just a few lines of code we will add a full WYSIWYG editing capability for entering the text to be displayed by our block. When completed, our simple Hello World block will have most of the functionality of the built-in HTML block, plus it will have its own capability to control access to who sees the resulting information.
To begin, let's tell Moodle that our block allows each instance to be configured. We do this by adding the instance_allow_config
function, and having it return true:
function instance_allow_config() { return true; }//function
Note that all Moodle modules also support Global Configuration, which is covered inChapter 3, Creating and Modifying Filters, on Filter Modules.