The World’s Largest Online Community for Developers

'; Using Moodle APIs to change strings in activity plugin - LavOzs.Com

In my Moodle activity plugin I am trying to allow an admin to change strings from the settings of the plugin. The strings that should be changeable are: Teacher, Class and Student . These are used throughout my plugin. . I am currently attempting it using php constants and that is working.

I am undecided if this is the the best method as I am converting an old plugin and not sure what string APIs I could use for Moodle 3.5.

Should I just proceed with the current method as it is working ?

If you use the standard Moodle handling for language strings (i.e. store them in [plugin]/lang/en/[nameofplugin].php and retrieve them with get_string() ), then an admin can override them by visiting Site admin > Language > Customise language pack.

That would be the normal way to allow for strings to be modified by admins (which would also allow for the words to be correctly handled in contexts, e.g. having the correct gender for the displayed language, handling plurals, etc.)

Moodle and C# - Web Service Configuration
Moodle Webservice API dont returns correctly
From Moodle Auto Login on Another Site on Clicking a Link
Store key value pairs in Moodle
Change Moodle Activity Plugin to Resource Plugin
WSO2 - Api Manager - Passing Post Body Params as URL query strings to Moodle
Creating moodle plugin to accept REST calls and create activities/notice/files
Persisting data for question type plugin in moodle
Call to undefined function mysql_connect after upgrade to Moodle 3.6
Injecting CSS in a Moodle course format plugin