|
|
Line 1: |
Line 1: |
| {{Moodle 2.0}} | | {{Moodle 2.0}} |
|
| |
| == The Specialists ==
| |
|
| |
| To customize the block's title under Moodle 2.0 the following code can be used:
| |
|
| |
| edit_form.php
| |
|
| |
| <code php>
| |
| $mform->addElement('text', 'config_title', get_string('configtitle', 'block_simplehtml'));
| |
| $mform->setDefault('config_title', get_string('simplehtml', 'block_simplehtml'));
| |
| $mform->setType('config_title', PARAM_MULTILANG);
| |
| </code>
| |
|
| |
| simplehtml/lang/en/block_simplehtml.php
| |
|
| |
| <code php>
| |
| $string['configtitle'] = 'Title of simple html';
| |
| </code>
| |
|
| |
| block_simplehtml.php
| |
|
| |
| <code php>
| |
| function specialization() {
| |
| $this->title = isset($this->config->title) ? format_string($this->config->title) : format_string(get_string('simplehtml', 'block_simplehtml'));
| |
| }
| |
| </code>
| |
|
| |
| The specialization function is copied from the html block. Different standard blocks seem to implement this differently. It would be nice if someone can explain what's happening in this specialization function.
| |
|
| |
| --[[User:Roel Cantada|Roel Cantada]] 11:43, 7 July 2011 (WST)
| |