本文整理汇总了PHP中Varien_Data_Form::setFieldNameSuffix方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form::setFieldNameSuffix方法的具体用法?PHP Varien_Data_Form::setFieldNameSuffix怎么用?PHP Varien_Data_Form::setFieldNameSuffix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form
的用法示例。
在下文中一共展示了Varien_Data_Form::setFieldNameSuffix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$form->setHtmlIdPrefix("template");
$form->setFieldNameSuffix("template");
/* @var $template Mzax_Emarketing_Model_Template */
$template = Mage::registry('current_template');
if ($template->getId()) {
$form->addField('template_id', 'hidden', array('name' => 'template_id', 'value' => $template->getId()));
}
$fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Template Option'), 'class' => 'fieldset-wide'))->addType('editor', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_templateEditor'))->addType('credits', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_credits'));
$fieldset->addField('credits', 'credits', array('name' => 'credits', 'required' => true));
$fieldset->addField('name', 'text', array('name' => 'name', 'required' => true, 'label' => $this->__('Template Name'), 'title' => $this->__('Template Name')));
$fieldset->addField('description', 'textarea', array('name' => 'description', 'required' => true, 'label' => $this->__('Description'), 'title' => $this->__('Description'), 'style' => 'height:4em;', 'note' => "For internal use only"));
$snippets = new Mzax_Emarketing_Model_Medium_Email_Snippets();
Mage::getSingleton('mzax_emarketing/medium_email')->prepareSnippets($snippets);
$editorConfig = new Varien_Object();
$editorConfig->setFilesBrowserWindowUrl($this->getUrl('adminhtml/cms_wysiwyg_images/index'));
$editorConfig->setWidgetWindowUrl($this->getUrl('adminhtml/widget/index'));
$editorConfig->setSnippets($snippets);
$editor = $fieldset->addField('body', 'editor', array('name' => 'body', 'required' => true, 'label' => $this->__('Template HTML'), 'title' => $this->__('Template HTML'), 'logo' => $this->getSkinUrl('images/logo.gif'), 'fullscreen_title' => $this->__('Template %s', $template->getName()), 'style' => 'height:50em;', 'value' => '', 'config' => $editorConfig));
// Setting custom renderer for content field to remove label column
$renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')->setTemplate('cms/page/edit/form/renderer/content.phtml');
$editor->setRenderer($renderer);
$form->addValues($template->getData());
$this->setForm($form);
$form->setUseContainer(true);
return parent::_prepareForm();
}
示例2: getConditionsForm
/**
* Rule form getter
*
* @return Varien_Data_Form
*/
public function getConditionsForm()
{
if (!$this->conditionsForm) {
$this->conditionsForm = new Varien_Data_Form();
$this->conditionsForm->setHtmlIdPrefix('rule__conditions__');
$this->conditionsForm->setFieldNameSuffix('rule[conditions]');
$this->conditionsForm->addType('select', Mage::getConfig()->getModelClassName('Aoe_FraudManager/Form_Element_Select'));
}
return $this->conditionsForm;
}
示例3: getForm
/**
* Retrieve Varien Data Form
*
* @return Varien_Data_Form
*/
public function getForm()
{
if (!$this->_form) {
$this->_form = new Varien_Data_Form();
$this->_form->setElementRenderer(Mage::getBlockSingleton('mzax_emarketing/editable')->setFormat('form'));
$this->_form->setHtmlIdPrefix("emulate_");
$this->_form->setFieldNameSuffix("emulate");
}
return $this->_form;
}
示例4: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('deal_');
$form->setFieldNameSuffix('deal');
$this->setForm($form);
$fieldset = $form->addFieldset('deal_form', array('legend' => Mage::helper('deal')->__('Deal Information')));
$fieldset->addField('name', 'text', array('label' => Mage::helper('deal')->__('Deal Name'), 'name' => 'name', 'required' => true, 'class' => 'required-entry', 'onchange' => "document.getElementById('deal_url_key').value = (document.getElementById('deal_name').value).replace(/[^a-z0-9\\s]/gi, '').replace(/[_\\s]/g, '').toLowerCase();"));
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('start_date', 'date', array('label' => Mage::helper('deal')->__('Start Date'), 'name' => 'start_date', 'note' => $this->__('Deal Start Date'), 'required' => true, 'class' => 'required-entry', 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso, 'onchange' => "Checkdate(document.getElementById('deal_start_date').value,document.getElementById('deal_end_date').value)"));
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('end_date', 'date', array('label' => Mage::helper('deal')->__('End Date'), 'name' => 'end_date', 'note' => $this->__('Deal Expiry Date'), 'required' => true, 'class' => 'required-entry', 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso, 'onchange' => "Checkdate(document.getElementById('deal_start_date').value,document.getElementById('deal_end_date').value)"));
$fieldset->addField('url_key', 'text', array('label' => Mage::helper('deal')->__('Url key'), 'name' => 'url_key', 'required' => true, 'class' => 'required-entry', 'note' => Mage::helper('deal')->__('Relative to Website Base URL')));
$fieldset->addField('status', 'select', array('label' => Mage::helper('deal')->__('Status'), 'name' => 'status', 'values' => array(array('value' => '1', 'label' => Mage::helper('deal')->__('Enabled')), array('value' => '0', 'label' => Mage::helper('deal')->__('Disabled'))), 'value' => 1));
$fieldset->addField('in_rss', 'select', array('label' => Mage::helper('deal')->__('Show in rss'), 'name' => 'in_rss', 'values' => array(array('value' => 1, 'label' => Mage::helper('deal')->__('Yes')), array('value' => 0, 'label' => Mage::helper('deal')->__('No')))));
if (Mage::app()->isSingleStoreMode()) {
$fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
Mage::registry('current_deal')->setStoreId(Mage::app()->getStore(true)->getId());
}
if (Mage::getSingleton('adminhtml/session')->getDealData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getDealData());
Mage::getSingleton('adminhtml/session')->setDealData(null);
} elseif (Mage::registry('current_deal')) {
$form->setValues(Mage::registry('current_deal')->getData());
}
return parent::_prepareForm();
}
示例5: _prepareForm
/**
* prepare the form
*
* @access protected
* @return DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Edit_Tab_Form
*/
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('anymarketorders_');
$form->setFieldNameSuffix('anymarketorders');
$this->setForm($form);
$fieldset = $form->addFieldset('anymarketorders_form', array('legend' => Mage::helper('db1_anymarket')->__('Anymarket Orders')));
$fieldset->addField('nmo_id_anymarket', 'text', array('label' => Mage::helper('db1_anymarket')->__('Code Anymarket'), 'name' => 'nmo_id_anymarket', 'required' => true, 'class' => 'required-entry'));
$fieldset->addField('nmo_id_order', 'text', array('label' => Mage::helper('db1_anymarket')->__('Code Order Magento'), 'name' => 'nmo_id_order', 'required' => false));
$fieldset->addField('nmo_id_seq_anymarket', 'text', array('label' => Mage::helper('db1_anymarket')->__('Code Order Seq Magento'), 'name' => 'nmo_id_seq_anymarket', 'required' => false));
$fieldset->addField('nmo_status_int', 'text', array('label' => Mage::helper('db1_anymarket')->__('Integration Status'), 'name' => 'nmo_status_int', 'required' => true, 'class' => 'required-entry'));
$fieldset->addField('nmo_desc_error', 'text', array('label' => Mage::helper('db1_anymarket')->__('Error Message'), 'name' => 'nmo_desc_error', 'required' => true, 'class' => 'required-entry'));
$fieldset->addField('status', 'select', array('label' => Mage::helper('db1_anymarket')->__('Status'), 'name' => 'status', 'values' => array(array('value' => 1, 'label' => Mage::helper('db1_anymarket')->__('Enabled')), array('value' => 0, 'label' => Mage::helper('db1_anymarket')->__('Disabled')))));
if (Mage::app()->isSingleStoreMode()) {
$fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
Mage::registry('current_anymarketorders')->setStoreId(Mage::app()->getStore(true)->getId());
}
$formValues = Mage::registry('current_anymarketorders')->getDefaultValues();
if (!is_array($formValues)) {
$formValues = array();
}
if (Mage::getSingleton('adminhtml/session')->getAnymarketordersData()) {
$formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getAnymarketordersData());
Mage::getSingleton('adminhtml/session')->setAnymarketordersData(null);
} elseif (Mage::registry('current_anymarketorders')) {
$formValues = array_merge($formValues, Mage::registry('current_anymarketorders')->getData());
}
$form->setValues($formValues);
return parent::_prepareForm();
}
示例6: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form();
/**
* Initialize product object as form property
* for using it in elements generation
*/
$form->setDataObject(Mage::registry('product'));
$fieldset = $form->addFieldset('group_fields', array());
$attributes = $this->getGroupAttributes();
$this->_setFieldset($attributes, $fieldset, array('gallery'));
$values = Mage::registry('product')->getData();
/**
* Set attribute default values for new product
*/
if (!Mage::registry('product')->getId()) {
foreach ($attributes as $attribute) {
if (!isset($values[$attribute->getAttributeCode()])) {
$values[$attribute->getAttributeCode()] = $attribute->getDefaultValue();
}
}
}
Mage::dispatchEvent('adminhtml_catalog_product_edit_prepare_form', array('form' => $form));
$form->addValues($values);
$form->setFieldNameSuffix('product');
$this->setForm($form);
}
示例7: _prepareForm
protected function _prepareForm()
{
$model = Mage::getModel('webforms/webforms');
$form = new Varien_Data_Form();
$renderer = $this->getLayout()->createBlock('webforms/adminhtml_element_field');
$form->setFieldsetElementRenderer($renderer);
$form->setFieldNameSuffix('field');
$form->setDataObject(Mage::registry('field'));
$this->setForm($form);
$fieldset = $form->addFieldset('webforms_form', array('legend' => Mage::helper('webforms')->__('Validation')));
$fieldset->addField('validate_length_min', 'text', array('label' => Mage::helper('webforms')->__('Minimum length'), 'class' => 'validate-number', 'name' => 'validate_length_min'));
$fieldset->addField('validate_length_max', 'text', array('label' => Mage::helper('webforms')->__('Maximum length'), 'class' => 'validate-number', 'name' => 'validate_length_max'));
$fieldset->addField('validate_regex', 'text', array('label' => Mage::helper('webforms')->__('Validation RegEx'), 'name' => 'validate_regex', 'note' => Mage::helper('webforms')->__('Validate with custom regular expression')));
$fieldset->addField('validate_message', 'textarea', array('label' => Mage::helper('webforms')->__('Validation error message'), 'name' => 'validate_message', 'note' => Mage::helper('webforms')->__('Displayed error message text if regex validation fails')));
Mage::dispatchEvent('webforms_adminhtml_fields_edit_tab_design_prepare_form', array('form' => $form, 'fieldset' => $fieldset));
if (Mage::registry('field')->getData('validate_length_min') == 0) {
Mage::registry('field')->setData('validate_length_min', '');
}
if (Mage::registry('field')->getData('validate_length_max') == 0) {
Mage::registry('field')->setData('validate_length_max', '');
}
if (Mage::getSingleton('adminhtml/session')->getWebFormsData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getWebFormsData());
Mage::getSingleton('adminhtml/session')->setWebFormsData(null);
} elseif (Mage::registry('field')) {
$form->setValues(Mage::registry('field')->getData());
}
return parent::_prepareForm();
}
示例8: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$prefix = '_customerbalance';
$form->setHtmlIdPrefix($prefix);
$form->setFieldNameSuffix('customerbalance');
$customer = Mage::getModel('customer/customer')->load($this->getRequest()->getParam('id'));
/** @var $fieldset Varien_Data_Form_Element_Fieldset */
$fieldset = $form->addFieldset('storecreidt_fieldset', array('legend' => Mage::helper('enterprise_customerbalance')->__('Update Balance')));
if (!Mage::getSingleton('enterprise_customerbalance/balance')->shouldCustomerHaveOneBalance($customer)) {
$fieldset->addField('website_id', 'select', array('name' => 'website_id', 'label' => Mage::helper('enterprise_customerbalance')->__('Website'), 'title' => Mage::helper('enterprise_customerbalance')->__('Website'), 'values' => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm(), 'onchange' => 'updateEmailWebsites()'));
}
$fieldset->addField('amount_delta', 'text', array('name' => 'amount_delta', 'label' => Mage::helper('enterprise_customerbalance')->__('Update Balance'), 'title' => Mage::helper('enterprise_customerbalance')->__('Update Balance'), 'comment' => Mage::helper('enterprise_customerbalance')->__('An amount on which to change the balance')));
$fieldset->addField('notify_by_email', 'checkbox', array('name' => 'notify_by_email', 'label' => Mage::helper('enterprise_customerbalance')->__('Notify Customer by Email'), 'title' => Mage::helper('enterprise_customerbalance')->__('Notify Customer by Email'), 'after_element_html' => '<script type="text/javascript">' . "\n updateEmailWebsites();\n \$('{$prefix}notify_by_email').disableSendemail = function() {\n \$('{$prefix}store_id').disabled = (this.checked) ? false : true;\n }.bind(\$('{$prefix}notify_by_email'));\n Event.observe('{$prefix}notify_by_email', 'click', \$('{$prefix}notify_by_email').disableSendemail);\n \$('{$prefix}notify_by_email').disableSendemail();\n " . '</script>'));
$field = $fieldset->addField('store_id', 'select', array('name' => 'store_id', 'label' => Mage::helper('enterprise_customerbalance')->__('Send Email Notification From the Following Store View'), 'title' => Mage::helper('enterprise_customerbalance')->__('Send Email Notification From the Following Store View')));
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
$field->setRenderer($renderer);
$fieldset->addField('comment', 'text', array('name' => 'comment', 'label' => Mage::helper('enterprise_customerbalance')->__('Comment'), 'title' => Mage::helper('enterprise_customerbalance')->__('Comment'), 'comment' => Mage::helper('enterprise_customerbalance')->__('Comment')));
if ($customer->isReadonly()) {
if ($form->getElement('website_id')) {
$form->getElement('website_id')->setReadonly(true, true);
}
$form->getElement('store_id')->setReadonly(true, true);
$form->getElement('amount_delta')->setReadonly(true, true);
$form->getElement('notify_by_email')->setReadonly(true, true);
}
$form->setValues($customer->getData());
$this->setForm($form);
return $this;
}
示例9: _prepareForm
/**
* Prepare form before rendering HTML
*
* @return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareForm()
{
$help = Mage::helper('antoinek_slider');
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('slider_');
$form->setFieldNameSuffix('slider');
$entity = Mage::registry('current_slider');
$form->setDataObject($entity);
if ($entity->getId()) {
$form->addField('slider_id', 'hidden', array('name' => 'slider_id'));
}
$fieldset = $form->addFieldset('general', array('legend' => $help->__('General Information')));
$fieldset->addField('title', 'text', array('name' => 'title', 'label' => $help->__('Title'), 'title' => $help->__('Title'), 'required' => true));
if (!Mage::app()->isSingleStoreMode()) {
$field = $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => Mage::helper('cms')->__('Store View'), 'title' => Mage::helper('cms')->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
$field->setRenderer($renderer);
} else {
$fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
$entity->setStoreId(Mage::app()->getStore(true)->getId());
}
$fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => Mage::helper('adminhtml')->__('Status'), 'title' => Mage::helper('adminhtml')->__('Status'), 'required' => true, 'options' => array('1' => Mage::helper('cms')->__('Enabled'), '0' => Mage::helper('cms')->__('Disabled'))));
Mage::dispatchEvent('antoinek_slider_adminhtml_slider_edit_tab_general_prepare_form', array('form' => $form));
$form->setValues($entity->getData());
$this->setForm($form);
return parent::_prepareForm();
}
示例10: _prepareForm
/**
* Prepare form before rendering HTML
*
* @return Enterprise_Staging_Block_Manage_Staging_Edit_Tabs_Item
*/
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$staging = $this->getStaging();
$collection = $staging->getItemsCollection();
$fieldset = $form->addFieldset('staging_dataset_item', array('legend' => Mage::helper('enterprise_staging')->__('Select Items to be Merged')));
$extendInfo = $this->getExtendInfo();
foreach (Mage::getSingleton('enterprise_staging/staging_config')->getStagingItems() as $stagingItem) {
if ((int) $stagingItem->is_backend) {
continue;
}
$_code = (string) $stagingItem->getName();
$disabled = "none";
$note = "";
//process extend information
if (!empty($extendInfo) && is_array($extendInfo)) {
if ($extendInfo[$_code]["disabled"] == true) {
$disabled = "disabled";
$note = '<div style="color:#900">' . $extendInfo[$_code]["note"] . "<div>";
} else {
$note = '<div style="color:#090">' . $extendInfo[$_code]["note"] . "<div>";
}
}
$fieldset->addField('staging_item_code_' . $_code, 'checkbox', array('label' => Mage::helper('enterprise_staging')->__((string) $stagingItem->label), 'name' => "{$_code}[staging_item_code]", 'value' => $_code, 'checked' => true, $disabled => true, 'note' => $note));
}
$form->setFieldNameSuffix($this->getFieldNameSuffix());
$this->setForm($form);
return parent::_prepareForm();
}
示例11: _prepareForm
protected function _prepareForm()
{
$model = Mage::registry('current_model');
$form = new Varien_Data_Form();
$form->setFieldNameSuffix('feed');
$this->setForm($form);
$general = $form->addFieldset('general', array('legend' => Mage::helper('feedexport')->__('Scheduled Task')));
$general->addField('cron', 'select', array('name' => 'cron', 'label' => Mage::helper('feedexport')->__('Status'), 'value' => $model->getCron(), 'values' => Mage::getModel('adminhtml/system_config_source_enabledisable')->toOptionArray(), 'note' => Mage::helper('feedexport/help')->field('cron')));
$general->addField('cron_day', 'multiselect', array('label' => Mage::helper('feedexport')->__('Day'), 'required' => false, 'name' => 'cron_day', 'values' => Mage::getSingleton('feedexport/system_config_source_day')->toOptionArray(), 'value' => $model->getCronDay()));
$general->addField('cron_time', 'multiselect', array('label' => Mage::helper('feedexport')->__('Time'), 'required' => false, 'name' => 'cron_time', 'values' => Mage::getSingleton('feedexport/system_config_source_time')->toOptionArray(), 'value' => $model->getCronTime()));
$cronStatus = Mage::helper('mstcore/cron')->checkCronStatus(false, false, 'Cron job is required for generated feed by schedule.');
if ($cronStatus !== true) {
$general->addField('cronjob_status', 'note', array('name' => 'cronjob_status', 'label' => Mage::helper('feedexport')->__('Cron job'), 'note' => $cronStatus));
}
$general->addField('currrent_time', 'label', array('name' => 'currrent_time', 'label' => Mage::helper('feedexport')->__('Current Time'), 'value' => Mage::getSingleton('core/date')->date('d.m.Y H:i')));
$cron = Mage::getModel('cron/schedule')->getCollection()->setOrder('executed_at', 'desc')->setPageSize(1)->getFirstItem();
$last = '-';
if ($cron->getExecutedAt()) {
$last = Mage::getSingleton('core/date')->date('d.m.Y H:i', strtotime($cron->getExecutedAt()));
}
$general->addField('last_cron_run', 'label', array('name' => 'last_cron_run', 'label' => Mage::helper('feedexport')->__('Last cron run time'), 'value' => $last));
$cron = Mage::getModel('cron/schedule')->getCollection()->addFieldToFilter('job_code', 'feedexport_job')->setOrder('executed_at', 'desc')->setPageSize(1)->getFirstItem();
$last = '-';
if ($cron->getExecutedAt()) {
$last = Mage::getSingleton('core/date')->date('d.m.Y H:i', strtotime($cron->getExecutedAt()));
}
$general->addField('last_job_run', 'label', array('name' => 'last_job_run', 'label' => Mage::helper('feedexport')->__('Last feed job run time'), 'value' => $last));
return parent::_prepareForm();
}
示例12: initForm
/**
* Preparing form - container, which contains all attributes
*
* @return Enterprise_Rma_Block_Adminhtml_Rma_Edit_Item
*/
public function initForm()
{
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('_rma');
$form->setFieldNameSuffix();
$item = Mage::registry('current_rma_item');
if (!$item->getId()) {
// for creating RMA process when we have no item loaded, $item is just empty model
$this->_populateItemWithProductData($item);
}
/* @var $customerForm Mage_Customer_Model_Form */
$customerForm = Mage::getModel('enterprise_rma/item_form');
$customerForm->setEntity($item)->setFormCode('default')->initDefaultValues();
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('enterprise_rma')->__('RMA Item Details')));
$fieldset->setProductName($this->escapeHtml($item->getProductAdminName()));
$okButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('enterprise_rma')->__('OK'), 'class' => 'ok_button'));
$fieldset->setOkButton($okButton->toHtml());
$cancelButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('enterprise_rma')->__('Cancel'), 'class' => 'cancel_button'));
$fieldset->setCancelButton($cancelButton->toHtml());
$attributes = $customerForm->getUserAttributes();
foreach ($attributes as $attribute) {
$attribute->unsIsVisible();
}
$this->_setFieldset($attributes, $fieldset);
$form->setValues($item->getData());
$this->setForm($form);
return $this;
}
示例13: _prepareForm
protected function _prepareForm()
{
$model = Mage::getModel('webforms/webforms');
$form = new Varien_Data_Form();
$form->setFieldNameSuffix('field');
$form->setDataObject(Mage::registry('field'));
$this->setForm($form);
$fieldset = $form->addFieldset('webforms_form', array('legend' => Mage::helper('webforms')->__('Design')));
$fieldset->addField('size', 'select', array('label' => Mage::helper('webforms')->__('Size'), 'name' => 'size', 'values' => Mage::getModel('webforms/fields')->getSizeTypes(), 'note' => Mage::helper('webforms')->__('Standard - two neighbour fields will be merged in one row<br />Wide - field will be wide and single in a row')));
$fieldset->addField('css_class', 'text', array('label' => Mage::helper('webforms')->__('Additional CSS classes for the input element'), 'name' => 'css_class', 'note' => Mage::helper('webforms')->__('You can use it for additional field validation (see Prototype validation classes)')));
$fieldset->addField('css_style', 'text', array('label' => Mage::helper('webforms')->__('Additional CSS style for the input element'), 'name' => 'css_style', 'note' => Mage::helper('webforms')->__('Add custom stylization to the input element')));
// $fieldset = $form->addFieldset('field_result', array(
// 'legend' => Mage::helper('webforms')->__('Results / Notifications')
// ));
// $fieldset->addField('result_display', 'select', array(
// 'label' => Mage::helper('webforms')->__('Display field'),
// 'title' => Mage::helper('webforms')->__('Display field'),
// 'name' => 'result_display',
// 'note' => Mage::helper('webforms')->__('Display field in result / notification messages'),
// 'values' => Mage::getModel('webforms/fields_display')->toOptionArray(),
// ));
Mage::dispatchEvent('webforms_adminhtml_fields_edit_tab_design_prepare_form', array('form' => $form, 'fieldset' => $fieldset));
if (Mage::getSingleton('adminhtml/session')->getWebFormsData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getWebFormsData());
Mage::getSingleton('adminhtml/session')->setWebFormsData(null);
} elseif (Mage::registry('field')) {
$form->setValues(Mage::registry('field')->getData());
}
return parent::_prepareForm();
}
示例14: _prepareForm
/**
* Preparing form elements for editing Entity Type
*
* @return $this
*/
protected function _prepareForm()
{
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save'), 'method' => 'post'));
$entityType = Mage::registry('etm_entity_type');
$fieldSet = $form->addFieldset('entity_type_data', array('class' => 'fieldset-wide', 'legend' => Mage::helper('goodahead_etm')->__('General')));
$validateClass = sprintf('required-entry validate-code validate-length maximum-length-%d', Goodahead_Core_Helper_Data::getConstValue('Mage_Eav_Model_Entity_Attribute::ATTRIBUTE_CODE_MAX_LENGTH', 50));
$fieldSet->addField('entity_type_code', 'text', array('label' => Mage::helper('goodahead_etm')->__('Entity Type Code'), 'name' => 'entity_type_code', 'class' => $validateClass, 'required' => true));
$fieldSet->addField('entity_type_name', 'text', array('label' => Mage::helper('goodahead_etm')->__('Entity Type Name'), 'name' => 'entity_type_name', 'class' => 'required-entry', 'required' => true));
if ($entityType->getId()) {
// $form->addField('entity_type_id', 'hidden', array(
// 'name' => 'entity_type_id',
// ));
// TODO: Rework
$entityTypeAttributes = Mage::getModel('goodahead_etm/source_entity_attribute')->toOptionsArrayWithoutExcludedTypes($entityType, true, array('boolean', 'multiselect', 'select', 'image', 'static'));
$fieldSet->addField('default_attribute_id', 'select', array('label' => Mage::helper('goodahead_etm')->__('Default Attribute'), 'name' => 'default_attribute_id', 'required' => false, 'values' => $entityTypeAttributes, 'note' => Mage::helper('goodahead_etm')->__('This attribute is used to display entity label')), 'entity_type_name');
$form->getElement('entity_type_code')->setReadonly('readonly');
$form->getElement('entity_type_code')->setDisabled(1);
Mage::dispatchEvent('goodahead_etm_entity_types_edit_prepare_form_main_section', array('form' => $form));
$form->setValues($entityType->getData());
} else {
Mage::dispatchEvent('goodahead_etm_entity_types_edit_prepare_form_main_section', array('form' => $form));
}
$form->setFieldNameSuffix('data');
$this->setForm($form);
return parent::_prepareForm();
}
示例15: _prepareForm
/**
* Prepare attributes form
*
* @return null
*/
protected function _prepareForm()
{
$group = $this->getGroup();
if ($group) {
$form = new Varien_Data_Form();
// Initialize product object as form property to use it during elements generation
$form->setDataObject(Mage::registry('product'));
$fieldset = $form->addFieldset('group_fields' . $group->getId(), array('legend' => Mage::helper('catalog')->__($group->getAttributeGroupName()), 'class' => 'fieldset-wide'));
$attributes = $this->getGroupAttributes();
$this->_setFieldset($attributes, $fieldset, array('gallery'));
$urlKey = $form->getElement('url_key');
if ($urlKey) {
$urlKey->setRenderer($this->getLayout()->createBlock('adminhtml/catalog_form_renderer_attribute_urlkey'));
}
$tierPrice = $form->getElement('tier_price');
if ($tierPrice) {
$tierPrice->setRenderer($this->getLayout()->createBlock('marketplace/adminhtml_catalog_product_edit_tab_price_tier'));
}
$groupPrice = $form->getElement('group_price');
if ($groupPrice) {
$groupPrice->setRenderer($this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_group'));
}
// $recurringProfile = $form->getElement('recurring_profile');
// if ($recurringProfile) {
// $recurringProfile->setRenderer(
// $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_recurring')
// );
// }
// Add new attribute button if it is not an image tab
if (!$form->getElement('media_gallery') && Mage::getSingleton('admin/session')->isAllowed('catalog/attributes/attributes')) {
$headerBar = $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_attributes_create');
$headerBar->getConfig()->setTabId('group_' . $group->getId())->setGroupId($group->getId())->setStoreId($form->getDataObject()->getStoreId())->setAttributeSetId($form->getDataObject()->getAttributeSetId())->setTypeId($form->getDataObject()->getTypeId())->setProductId($form->getDataObject()->getId());
$fieldset->setHeaderBar($headerBar->toHtml());
}
if ($form->getElement('meta_description')) {
$form->getElement('meta_description')->setOnkeyup('checkMaxLength(this, 255);');
}
$values = Mage::registry('product')->getData();
// Set default attribute values for new product
if (!Mage::registry('product')->getId()) {
foreach ($attributes as $attribute) {
if (!isset($values[$attribute->getAttributeCode()])) {
$values[$attribute->getAttributeCode()] = $attribute->getDefaultValue();
}
}
}
if (Mage::registry('product')->hasLockedAttributes()) {
foreach (Mage::registry('product')->getLockedAttributes() as $attribute) {
$element = $form->getElement($attribute);
if ($element) {
$element->setReadonly(true, true);
}
}
}
$form->addValues($values);
$form->setFieldNameSuffix('product');
Mage::dispatchEvent('adminhtml_catalog_product_edit_prepare_form', array('form' => $form));
$this->setForm($form);
}
}