Andrew Nicols d56303aa54
MDL-80072 core: Promote all formatting options to parameters
Now that PHP has support for named parameters, and we can use them in
Moodle, we should ditch `$options` arrays and use first-class,
documented, parameters.

Whilst this may seem scary, dumb, overwhelming, please note that you do
not need to supply all args, for example, to change the last parameter
of `format_text` you no longer need to do this:

    return \core\container::get(\core\formatting::class)->format_text(
       $text,
       FORMAT_MOODLE,
       $context,
       false,
       null,
       true,
       true,
       true,
       false,
       false,
       true,
    );

Instead you can do:

    return \core\container::get(\core\formatting::class)->format_text(
       $text,
       FORMAT_MOODLE,
       $context,
       allowid: true,
    );

Or better still:

    return \core\container::get(\core\formatting::class)->format_text(
       text: $text,
       format: FORMAT_MOODLE,
       context: $context,
       allowid: true,
    );

This means that we can get defaults in the function signature, improves
our typing, and allows for deprecation and changes to options. It also
sets us up for success in the future.
2024-02-12 11:11:18 +08:00
2024-02-08 16:18:06 +01:00

Moodle

The Moodle Logo

Moodle is the World's Open Source Learning Platform, widely used around the world by countless universities, schools, companies, and all manner of organisations and individuals.

Moodle is designed to allow educators, administrators and learners to create personalised learning environments with a single robust, secure and integrated system.

Documentation

Community

moodle.org is the central hub for the Moodle Community, with spaces for educators, administrators and developers to meet and work together.

You may also be interested in:

Installation and hosting

Moodle is Free, and Open Source software. You can easily download Moodle and run it on your own web server, however you may prefer to work with one of our experienced Moodle Partners.

Moodle also offers hosting through both MoodleCloud, and our partner network.

License

Moodle is provided freely as open source software, under version 3 of the GNU General Public License. For more information on our license see

Description
No description provided
Readme 1.2 GiB
Languages
PHP 78.1%
JavaScript 14.6%
Gherkin 3.5%
CSS 1.7%
Mustache 1.6%
Other 0.4%