MDL-49152 output: Templates for renderers (JS and PHP)

Mustache support for rendering templates from either php or js.
This commit is contained in:
Damyon Wiese
2015-03-14 22:48:40 +08:00
parent 72f8324ec5
commit 9bdcf57951
66 changed files with 6532 additions and 33 deletions
+32
View File
@@ -39,6 +39,28 @@ interface renderable {
// intentionally empty
}
/**
* Interface marking other classes having the ability to export their data for use by templates.
*
* @copyright 2015 Damyon Wiese
* @package core
* @category output
* @since 2.9
*/
interface templatable {
/**
* 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).
*
* @param renderer_base $output Used to do a final render of any components that need to be rendered for export.
* @return stdClass|array
*/
public function export_for_template(renderer_base $output);
}
/**
* Data structure representing a file picker.
*
@@ -602,6 +624,16 @@ class single_button implements renderable {
*/
var $actions = array();
/**
* @var array $params URL Params
*/
var $params;
/**
* @var string Action id
*/
var $actionid;
/**
* Constructor
* @param moodle_url $url