本文整理汇总了PHP中Varien_Data_Form::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form::setData方法的具体用法?PHP Varien_Data_Form::setData怎么用?PHP Varien_Data_Form::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form
的用法示例。
在下文中一共展示了Varien_Data_Form::setData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareForm
/**
* @return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareForm()
{
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
$form->setData('use_container', true);
$this->setForm($form);
return parent::_prepareForm();
}
示例2: createForm
/**
* @return Varien_Data_Form
*/
private function createForm()
{
/** @var Varien_Data_Form $result */
$result = new Varien_Data_Form();
$result->setData('html_id_prefix', 'rule_');
$this->createFieldset($result);
df_assert($result instanceof Varien_Data_Form);
return $result;
}
示例3: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$form->setData('use_container', true);
$this->setForm($form);
$this->_addBaseFieldset();
$form->setValues($this->_getReport()->getData());
return parent::_prepareForm();
}
示例4: _prepareForm
protected function _prepareForm()
{
//$form = new Varien_Data_Form(array("encrypt","multipart/form-data"));
$form = new Varien_Data_Form(array('id' => 'addgiftvoucher', 'action' => $this->getData('action'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
$form->setData('enctype', 'multipart/form-data');
$form->setData('id', 'addgiftvoucher');
$this->setForm($form);
$fieldset = $form->addFieldset('customer', array('legend' => Mage::helper('giftcert')->__('Customer')));
$fieldset->addField('customer_name', 'text', array('label' => Mage::helper('giftcert')->__('Customer name'), 'name' => 'customer_name'));
$fieldset->addField('customer_email', 'text', array('label' => Mage::helper('giftcert')->__('Customer email'), 'name' => 'customer_email'));
$fieldset_recipient = $form->addFieldset('recipient', array('legend' => Mage::helper('giftcert')->__('Recipient')));
$fieldset_recipient->addField('recipient_name', 'text', array('label' => Mage::helper('giftcert')->__('Recipient name'), 'name' => 'recipient_name'));
$fieldset_recipient->addField('recipient_email', 'text', array('label' => Mage::helper('giftcert')->__('Recipient email'), 'name' => 'recipient_email'));
$fieldset_recipient->addField('recipient_address', 'textarea', array('label' => Mage::helper('giftcert')->__('Recipient Address'), 'name' => 'recipient_address'));
$fieldsetmess = $form->addFieldset('message_set', array('legend' => Mage::helper('giftcert')->__('Message')));
$fieldsetmess->addField('message', 'textarea', array('label' => Mage::helper('giftcert')->__('Message'), 'name' => 'message'));
if (Mage::getSingleton('adminhtml/session')->getgiftcertData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getgiftcertData());
Mage::getSingleton('adminhtml/session')->setgiftcertData(null);
} elseif (Mage::registry('giftcert_data')) {
$form->setValues(Mage::registry('giftcert_data')->getData());
}
return parent::_prepareForm();
}
示例5: init
/**
* @param Varien_Data_Form $form
* @param RK_TypeCMS_Model_Page $page
*/
public function init(Varien_Data_Form $form, RK_TypeCMS_Model_Page $page)
{
$attributes = $this->getAttributes();
if (!count($attributes)) {
return;
}
$fieldset = $form->addFieldset('typecms_fields', array('legend' => Mage::helper('typecms')->__('TypeCMS Fields'), 'class' => 'fieldset-wide'));
foreach ($attributes as $code => $attribute) {
$type = Mage::helper('typecms')->attributeTypeToFieldType($attribute['type']);
$label = Mage::helper('typecms')->__($attribute['label']);
if ($type == 'file') {
$field = $fieldset->addField('typecms_' . $code, 'file', array('name' => 'typecms[' . $code . ']', 'label' => $label, 'after_element_html' => '<script type="text/javascript">setTimeout(function(){$(\'edit_form\').enctype = \'multipart/form-data\';}, 50);</script>'));
if ($page->getData($code)) {
if ($attribute['type'] == 'image') {
$field->setData('after_element_html', '<br />
<img src="' . Mage::helper('typecms')->getBaseImageUrl() . $page->getData($code) . '" width="300" /><br />
<label><input type="checkbox" name="typecms[' . $code . '_delete]" value="1" /> Delete image</label>' . $field->getData('after_element_html'));
} else {
$field->setData('after_element_html', '<br />
' . Mage::helper('typecms')->escapeHtml($page->getData($code)) . '<br />
<label><input type="checkbox" name="typecms[' . $code . '_delete]" value="1" /> Delete file</label>' . $field->getData('after_element_html'));
}
}
$form->setData('enctype', 'multipart/form-data');
} else {
$field = $fieldset->addField('typecms_' . $code, $type, array('name' => 'typecms[' . $code . ']', 'label' => $label));
}
if ($attribute['type'] == 'yesno') {
$attribute['options'] = array(0 => 'No', 1 => 'Yes');
}
if ($type == 'editor') {
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('tab_id' => 'main'));
$field->addData(array('style' => 'height:36em;', 'config' => $wysiwygConfig));
} elseif ($type == 'select') {
$field->addData(array('values' => $attribute['options']));
}
}
}