Skip to content
Browse files

MDL-26956 (2) Forms: Function to render form to string

Previously it was only possible to display the form immediately as
HTML output. You had to wrap in an output buffer in order to put
it in a renderer. This new function does the output buffer for you.
  • Loading branch information...
sammarshallou committed Mar 27, 2013
1 parent b2ec866 commit d953b18495c82e7ac48b7d4b75fc4972df0f7ed6
Showing with 16 additions and 0 deletions.
  1. +16 −0 lib/formslib.php
@@ -921,6 +921,22 @@ function display() {
* Renders the html form (same as display, but returns the result).
* Note that you can only output this rendered result once per page, as
* it contains IDs which must be unique.
* @return string HTML code for the form
public function render() {
$out = ob_get_contents();
return $out;
* Form definition. Abstract method - always override!

0 comments on commit d953b18

Please sign in to comment.
You can’t perform that action at this time.