Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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