Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 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.

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