Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 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: 1 time
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