Problem with custom theme settings page

Problem with custom theme settings page

by Rahul Oza -
Number of replies: 2

Hello,

I am currently developing a custom Moodle 2 theme and have run into a small bug which I can't seem to fix with the settings page on my theme. I was wondering if someone could point me in the right direction with this one as I've run out of things to try...

In my /theme/nsl/lang/en directory I've got my language file with custom strings for the settings page as follows:

$string['bannerbg'] ='Banner background';
$string['bannerbgdesc'] ='The background image of the page banner.';

$string['bannerwidth'] ='Banner width';
$string['bannerwidthdesc'] ='The width of the banner background image.';

$string['bannerheight'] ='Banner background';
$string['bannerheightdesc'] ='The height of the banner background image.';

Note that the banner height string is incorrect - I changed this to 'Banner height' and refreshed the page after clearing theme cache but the string doesn't get replaced.

I've checked my settings.php page and it seems all ok in there:

$name ='theme_nsl/bannerheight';
$title = get_string('bannerheight','theme_nsl');
$description = get_string('bannerheightdesc','theme_nsl');
$default ='40px';
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_CLEAN);
$settings->add($setting);

I'm testing this on a local LAMP stack and I've restarted this and even cleared browser cache, and tested on a different browser but the string just doesn't seem to change.

Any help with this would be much appreciated!

Kind regards,

Rahul

Average of ratings: -
In reply to Rahul Oza

Re: Problem with custom theme settings page

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi Rahul,

The Clear Theme Cache does not clear the language strings cache which is separate. You will need to go to Site Administration > Development > Purge All Caches

HTH

Richard

In reply to Richard Oelmann

Re: Problem with custom theme settings page

by Rahul Oza -

Hi Richard,

Yes, that worked perfectly! I didn't realise that Moodle has multiple caches.

Thanks a lot for your help.

Regards,

Rahul