From 9292b6afc0f7a67c07b1b2fb1e03b893608a2472 Mon Sep 17 00:00:00 2001 From: defacer Date: Tue, 25 Jan 2005 03:13:13 +0000 Subject: [PATCH] More polishing. --- blocks/HOWTO.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blocks/HOWTO.html b/blocks/HOWTO.html index 6a5e3eb6f8..640c5210bd 100644 --- a/blocks/HOWTO.html +++ b/blocks/HOWTO.html @@ -238,7 +238,7 @@

It isn't difficult to see that the above code just provides us with a wysiwyg-editor-enabled textarea to write our block's desired content in and a submit button to save. But... what's $this->config->text? Well...

-

Moodle goes a long way to make things easier for block developers. Did you notice that the textarea is actually named "text"? When the submit button is pressed, Moodle saves each and every field it can find in our config_instance.html file as instance configuration data. We can then access that data as $this->config->variablename, where variablename is the actual name we used for our field; in this case, "text". So in essence, the above form just pre-populates the textarea with the current content of the block (as indeed it should) and then allows us to change it.

+

Moodle goes a long way to make things easier for block developers. Did you notice that the textarea is actually named "text"? When the submit button is pressed, Moodle saves each and every field it can find in our config_instance.html file as instance configuration data. We can then access that data as $this->config->variablename, where variablename is the actual name we used for our field; in this case, "text". So in essence, the above form just pre-populates the textarea with the current content of the block (as indeed it should) and then allows us to change it.

You also might be surprised by the presence of a submit button and the absence of any <form> element at the same time. But the truth is, we don't need to worry about that at all; Moodle goes a really long way to make things easier for developers! We just print the configuration options we want, in any format we want; include a submit button, and Moodle will handle all the rest itself. The instance configuration variables are automatically at our disposal to access from any of the class methods except init.

@@ -451,7 +451,7 @@ function instance_config_save($data) {

We will let this part of the tutorial come to a close with the obligatory excercise for the reader: in order to have the SimpleHTML block work "correctly", find out how to strengthen the eager approach to strip out all tags from the existing configuration of all instances of our block, or go back and implement the lazy approach instead. (Hint: do that in the get_content method)

-

UPDATING: Prior to version 1.5, the file "config_global.html" was named simply "config.hmtl". Also, the methods config_save and config_print were named handle_config and print_config respectively. Upgrading a block to work with Moodle 1.5 involves updating these aspects; refer to Appendix B for more information.

+

UPDATING: Prior to version 1.5, the file config_global.html was named simply config.html. Also, the methods config_save and config_print were named handle_config and print_config respectively. Upgrading a block to work with Moodle 1.5 involves updating these aspects; refer to Appendix B for more information.

@@ -983,7 +983,7 @@ function name() {
$this->content
-

This variable holds all the actual content that is displayed inside each block. Valid values for it are either NULL or an object of class stdClass, which must have specific member variables set as explained below. Normally, it begins life with a value of NULL and it becomes fully constructed (i.e., an object) when the get_content is called.

+

This variable holds all the actual content that is displayed inside each block. Valid values for it are either NULL or an object of class stdClass, which must have specific member variables set as explained below. Normally, it begins life with a value of NULL and it becomes fully constructed (i.e., an object) when get_content is called.

After it is fully constructed, this object is expected to have certain properties, depending on the value of $this->content_type. Specifically: -- 2.39.5