The Blocks Advanced tutorial

The Blocks Advanced tutorial

by Elie Reformed -
Number of replies: 2

Hi all, so after I have finished the Blocks Advanced tutorial, I still have all the labels in the form between brackets and I don't know why. 

For example: 

$mform->addElement('text', 'pagetitle', get_string('pagetitle', 'block_simplehtml'));
$mform->setType('pagetitle', PARAM_RAW);
$mform->addRule('pagetitle', null, 'required', null, 'client');
 

gives me this: [ [pagetitle ] ]







Average of ratings: -
In reply to Elie Reformed

Re: The Blocks Advanced tutorial

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Have you added the language string to blocks/MYBLOCKNAME/lang/en/block_MYBLOCKNAME.php ?

(i.e. $string['pagetitle'] = 'The name of this page'; )

After that, have you purged all caches (site admin > developer > purge all caches)? (Or you can bump the version number and run an upgrade, but purging caches is usually more convenient during development).

Average of ratings: Useful (1)
In reply to Davo Smith

Re: The Blocks Advanced tutorial

by Elie Reformed -
" Don't forget to include definitions for the new strings that you are creating, into block_simplehtml.php " is this what u'r saying to me, cause this sentence was in that tutorial and I didn't know how to do it...


In your example, what do you mean by 'The name of this page'?

tbh, I didn't understand what role has the lang folder. sad


edit: well well... after reading the String API doc I can see now what's going on... problem fixed. ty smile