Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 403]

Adds export_for_template behaviour to an mform element in a consistent and predictable way.

Copyright: 2016 Damyon Wiese
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 95 lines (4 kb)
Included or required: 20 times
Referenced: 0 times
Includes or requires: 1 file
 lib/outputcomponents.php

Defines 1 function


Functions that are not part of a class:

export_for_template(renderer_base $output)   X-Ref
Function to export the renderer data in a format that is suitable for a
mustache template. This means:
1. No complex types - only stdClass, array, int, string, float, bool
2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).

This trait can be used as-is for simple form elements - or imported with a different name
so it can be extended with additional context variables before being returned.

param: renderer_base $output Used to do a final render of any components that need to be rendered for export.
return: stdClass|array