From df5c8020c668d3104af017e4c6405396857b92a5 Mon Sep 17 00:00:00 2001 From: Reto Kaiser Date: Tue, 17 Feb 2015 18:48:00 +0100 Subject: [PATCH] Pass ViewResponse to Form::prepare() --- library/CM/Form/Abstract.php | 2 +- library/CM/Form/Example.php | 2 +- library/CM/Form/ExampleIcon.php | 2 +- library/CM/SmartyPlugins/block.form.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/CM/Form/Abstract.php b/library/CM/Form/Abstract.php index 782b35419..ebcf803d9 100755 --- a/library/CM/Form/Abstract.php +++ b/library/CM/Form/Abstract.php @@ -30,7 +30,7 @@ public function __construct($params = null) { $this->_initialize(); } - public function prepare(CM_Frontend_Environment $environment) { + public function prepare(CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse) { } /** diff --git a/library/CM/Form/Example.php b/library/CM/Form/Example.php index dda5afeca..0a609e7a1 100644 --- a/library/CM/Form/Example.php +++ b/library/CM/Form/Example.php @@ -22,7 +22,7 @@ protected function _initialize() { $this->registerAction(new CM_FormAction_Example_Go($this)); } - public function prepare(CM_Frontend_Environment $environment) { + public function prepare(CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse) { if (CM_Http_Request_Abstract::hasInstance()) { $ip = CM_Http_Request_Abstract::getInstance()->getIp(); if ($locationGuess = CM_Model_Location::findByIp($ip)) { diff --git a/library/CM/Form/ExampleIcon.php b/library/CM/Form/ExampleIcon.php index 58cbfad33..95bbea41c 100644 --- a/library/CM/Form/ExampleIcon.php +++ b/library/CM/Form/ExampleIcon.php @@ -12,7 +12,7 @@ protected function _initialize() { $this->registerField(new CM_FormField_Integer(['name' => 'shadowBlur', 'min' => 0, 'max' => 20])); } - public function prepare(CM_Frontend_Environment $environment) { + public function prepare(CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse) { $this->getField('sizeSlider')->setValue(18); $this->getField('shadowColor')->setValue('#333'); $this->getField('colorBackground')->setValue('#fafafa'); diff --git a/library/CM/SmartyPlugins/block.form.php b/library/CM/SmartyPlugins/block.form.php index 3100e4407..bcf4f3fcd 100644 --- a/library/CM/SmartyPlugins/block.form.php +++ b/library/CM/SmartyPlugins/block.form.php @@ -6,9 +6,9 @@ function smarty_block_form($params, $content, Smarty_Internal_Template $template $frontend = $render->getGlobalResponse(); if ($open) { $form = CM_Form_Abstract::factory($params['name'], $params); - $form->prepare($render->getEnvironment()); - $viewResponse = new CM_Frontend_ViewResponse($form); + $form->prepare($render->getEnvironment(), $viewResponse); + $frontend->treeExpand($viewResponse); return ''; } else {