Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/QuickForm2.php')
-rw-r--r--core/QuickForm2.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/core/QuickForm2.php b/core/QuickForm2.php
index 71cf9ef4a8..7ca6446c43 100644
--- a/core/QuickForm2.php
+++ b/core/QuickForm2.php
@@ -108,4 +108,29 @@ abstract class Piwik_QuickForm2 extends HTML_QuickForm2
$value = $this->getValue();
return isset($value[$elementName]) ? $value[$elementName] : null;
}
+
+ /**
+ * Returns the rendered form as an array.
+ *
+ * @param bool $groupErrors Whether to group errors together or not.
+ * @return array
+ */
+ public function getFormData( $groupErrors = true )
+ {
+ static $registered = false;
+ if(!$registered)
+ {
+ HTML_QuickForm2_Renderer::register('smarty', 'HTML_QuickForm2_Renderer_Smarty');
+ $registered = true;
+ }
+
+ // Create the renderer object
+ $renderer = HTML_QuickForm2_Renderer::factory('smarty');
+ $renderer->setOption('group_errors', $groupErrors);
+
+ // build the HTML for the form
+ $this->render($renderer);
+
+ return $renderer->toArray();
+ }
}