From e64ccc4f02b8d2937146114067dbb5b1c72c15b4 Mon Sep 17 00:00:00 2001 From: Fabian Blechschmidt Date: Thu, 6 Dec 2012 14:17:45 +0100 Subject: [PATCH] Problem described here and a patch for 1.7.0.2: http://www.magentocommerce.com/bug-tracking/issue?issue=14477 app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php:98 the event adminhtml_cms_page_edit_tab_content_prepare_form is dispatched. Two lines before the values are set on the form ($form->setValues($model->getData());) This order is only in the content tab. In the other tabs: design, main and meta the order is the other way around, e.g. app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php:125 Mage::dispatchEvent('adminhtml_cms_page_edit_tab_design_prepare_form', array('form' => $form)); $form->setValues($model->getData()); $this->setForm($form); To add new fields to the form and fill them automatically from the database it is important to change the order of the event and the setValues statement. I add a patch-file for this. --- .../core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php index bb57e17adbae1..f3ee75fbd723d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php @@ -92,10 +92,12 @@ protected function _prepareForm() ->setTemplate('cms/page/edit/form/renderer/content.phtml'); $contentField->setRenderer($renderer); + Mage::dispatchEvent('adminhtml_cms_page_edit_tab_content_prepare_form', array('form' => $form)); + $form->setValues($model->getData()); $this->setForm($form); - Mage::dispatchEvent('adminhtml_cms_page_edit_tab_content_prepare_form', array('form' => $form)); + return parent::_prepareForm(); }