/** * 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; }
function __prepareLayout($guide_block_name) { $form = new Varien_Data_Form(array('class' => 'hided_element')); $form->addType('guide_html', 'Meigee_Thememanager_Block_Adminhtml_Forms_Guide'); $form->addField('guide_html', 'guide_html', array('group' => $this->guide_block_name, 'block' => $guide_block_name)); $form->setUseContainer(false); $this->setForm($form); return parent::_prepareLayout(); }
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $this->setElement($element); $value = $element->getValue(); $cHlp = Mage::helper('udropship/catalog'); $cOpts = $cHlp->getCategoryValues(); if (!$value && $cHlp->getStoreRootCategory()) { $value = $cHlp->getStoreRootCategory()->getId(); } $_form = new Varien_Data_Form(); $_form->addType('categories_select', Mage::getConfig()->getBlockClassName('udropship/categoriesSelect')); $catBlock = $_form->addField($element->getId(), 'categories_select', array('name' => $element->getName(), 'label' => Mage::helper('udropship')->__('Select Category'), 'value' => $value, 'values' => $cOpts, 'skip_disabled' => 1)); $html = $catBlock->getElementHtml(); return $html; }
protected function _prepareForm() { $reAuthenticated = Mage::helper('twofactorauth/auth')->isReAuthenticated(); $action = $reAuthenticated ? 'qrSubmit' : 'password'; $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/' . $action, array('_current' => TRUE)), 'method' => 'post')); if ($reAuthenticated) { $form->addType('secret_questions', 'MageHackDay_TwoFactorAuth_Block_Adminhtml_Edit_Form_Element_Questions'); $form->addField('questions', 'secret_questions', array('name' => 'questions')); } else { $fieldset = $form->addFieldset('reenter_password', array('legend' => Mage::helper('twofactorauth')->__('Re-enter admin password'))); $fieldset->addField('password', 'password', array('label' => Mage::helper('twofactorauth')->__('Password'), 'required' => TRUE, 'name' => 'password')); } $form->setUseContainer(TRUE); $this->setForm($form); return parent::_prepareForm(); }
protected function _toHtml() { $form = new Varien_Data_Form(array('id' => 'wysiwyg_edit_form', 'action' => $this->getData('action'), 'method' => 'post')); $form->addType('editor', Mage::getConfig()->getBlockClassName('udropship/vendor_wysiwyg_form_element_editor')); $config['document_base_url'] = $this->getData('store_media_url'); $config['store_id'] = $this->getData('store_id'); $config['add_variables'] = false; $config['add_widgets'] = false; $config['add_directives'] = true; $config['use_container'] = true; $config['container_class'] = 'hor-scroll'; $config['directives_url'] = $this->getUrl('udropship/vendor_wysiwyg/directive'); $config['files_browser_window_url'] = $this->getUrl('udropship/vendor_wysiwyg_images/index'); $form->addField($this->getData('editor_element_id'), 'editor', array('name' => 'content', 'style' => 'width:725px;height:460px', 'required' => true, 'force_load' => true, 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig($config))); return $form->toHtml(); }
/** * Prepare form before rendering HTML * * @return Mage_Adminhtml_Block_Widget_Form */ protected function _prepareForm() { $vendorformFields = $this->getRegistrationAttributes(); $form = new Varien_Data_Form(); $form->setAction($this->getUrl('*/*/save', array('_secure' => true)))->setId('form-validate')->setMethod('POST')->setEnctype('multipart/form-data')->setUseContainer(false); $model = $this->getVendorId() ? $this->getVendor()->getData() : array(); $id = $this->getVendorId(); foreach ($vendorformFields as $attribute) { $ascn = 0; if (!$attribute || $attribute->hasUseInRegistration() && !$attribute->getUseInRegistration()) { continue; } if ($inputType = $attribute->getFrontend()->getInputType()) { if (!isset($model[$attribute->getAttributeCode()]) || isset($model[$attribute->getAttributeCode()]) && !$model[$attribute->getAttributeCode()]) { $model[$attribute->getAttributeCode()] = $attribute->getDefaultValue(); } if ($inputType == 'boolean') { $inputType = 'select'; } if (in_array($attribute->getAttributeCode(), Ced_CsMarketplace_Model_Form::$VENDOR_REGISTRATION_RESTRICTED_ATTRIBUTES)) { continue; } $fieldType = $inputType; $rendererClass = $attribute->getFrontend()->getInputRendererClass(); if (!empty($rendererClass)) { $fieldType = $inputType . '_' . $attribute->getAttributeCode(); $form->addType($fieldType, $rendererClass); } $afterHtmlShopUrl = '<div id="advice-validate-shopurl-ced-shop-url-field" class="validation-advice" style="display:none;">Shop Url is not available.</div> <span class="note"><small style="font-size: 10px;">' . Mage::helper('csmarketplace')->__('Please enter your Shop URL Key. For example "my-shop-url".') . '</small></span> <div style="clear:both"></div> <span style="float:left;" id="ced-csmarketplace-availability" > </span> <span style="float:left;" id="ced-csmarketplace-availability-suggestion" > </span> <div style="clear:both"></div>'; $element = $form->addField('ced-' . str_replace('_', '-', $attribute->getAttributeCode()) . '-field', $fieldType, array('container_id' => 'ced-' . str_replace('_', '-', $attribute->getAttributeCode()), 'name' => "vendor[" . $attribute->getAttributeCode() . "]", 'label' => $attribute->getStoreLabel() ? $attribute->getStoreLabel() : $attribute->getFrontend()->getLabel(), 'class' => 'form-control ' . $attribute->getFrontend()->getClass(), 'required' => $attribute->getIsRequired(), 'placeholder' => $attribute->getStoreLabel() ? $attribute->getStoreLabel() : $attribute->getFrontend()->getLabel(), 'value' => $model[$attribute->getAttributeCode()], 'after_element_html' => $attribute->getAttributeCode() == 'shop_url' ? $afterHtmlShopUrl : ''))->setEntityAttribute($attribute); if ($inputType == 'select') { $element->setValues($attribute->getSource()->getAllOptions(true, true)); } else { if ($inputType == 'multiselect') { $element->setValues($attribute->getSource()->getAllOptions(false, true)); $element->setCanBeEmpty(true); } else { if ($inputType == 'date') { $element->setImage($this->getSkinUrl('images/calendar.gif')); $element->setFormat(Mage::app()->getLocale()->getDateFormatWithLongYear()); } else { if ($inputType == 'multiline') { $element->setLineCount($attribute->getMultilineCount()); } } } } } } $this->setForm($form); return $this; }
/** * Prepare form before rendering HTML * * @return Mage_Adminhtml_Block_Widget_Form */ protected function _prepareForm() { $vendorformFields = $this->getVendorAttributes(); $form = new Varien_Data_Form(); $form->setAction($this->getUrl('*/*/save', array('_secure' => true)))->setId('form-validate')->setMethod('POST')->setEnctype('multipart/form-data')->setUseContainer(false); $model = $this->getVendorId() ? $this->getVendor()->getData() : array(); $id = $this->getVendorId(); foreach ($vendorformFields as $attribute) { $ascn = 0; if (!$attribute || $attribute->hasIsVisible() && !$attribute->getIsVisible()) { continue; } if ($inputType = $attribute->getFrontend()->getInputType()) { if (!isset($model[$attribute->getAttributeCode()]) || isset($model[$attribute->getAttributeCode()]) && !$model[$attribute->getAttributeCode()]) { $model[$attribute->getAttributeCode()] = $attribute->getDefaultValue(); } if ($inputType == 'boolean') { $inputType = 'select'; } if (in_array($attribute->getAttributeCode(), Ced_CsMarketplace_Model_Form::$VENDOR_FORM_READONLY_ATTRIBUTES)) { continue; } $fieldType = $inputType; $rendererClass = $attribute->getFrontend()->getInputRendererClass(); if (!empty($rendererClass)) { $fieldType = $inputType . '_' . $attribute->getAttributeCode(); $form->addType($fieldType, $rendererClass); } $element = $form->addField($attribute->getAttributeCode(), $fieldType, array('name' => "vendor[" . $attribute->getAttributeCode() . "]", 'label' => $attribute->getAttributeCode() != 'region' ? $attribute->getStoreLabel() ? $attribute->getStoreLabel() : $attribute->getFrontend()->getLabel() : '', 'class' => $ascn && $attribute->getAttributeCode() == 'shop_url' && $id ? '' : $attribute->getFrontend()->getClass(), 'required' => $ascn && $attribute->getAttributeCode() == 'shop_url' && $id ? false : $attribute->getIsRequired(), $ascn && in_array($attribute->getAttributeCode(), array('shop_url', 'email')) && $id ? 'href' : '' => $ascn && in_array($attribute->getAttributeCode(), array('shop_url', 'email')) && $id ? $shopUrl : '', $ascn && in_array($attribute->getAttributeCode(), array('shop_url', 'email')) && $id ? 'target' : '' => $ascn && $id ? $attribute->getAttributeCode() == 'shop_url' ? '_blank' : '' : '', 'value' => $model[$attribute->getAttributeCode()]))->setEntityAttribute($attribute); if ($attribute->getAttributeCode() == 'region_id') { $region_id = Mage::getModel('csmarketplace/vendor')->load($this->getVendor()->getId())->getData('region_id'); $element->setAfterElementHtml("<script type='text/javascript'>\$('region_id').setAttribute('defaultValue', '" . $region_id . "');</script>"); } if ($inputType == 'select') { $element->setValues($attribute->getSource()->getAllOptions(true, true)); } else { if ($inputType == 'multiselect') { $element->setValues($attribute->getSource()->getAllOptions(false, true)); $element->setCanBeEmpty(true); } else { if ($inputType == 'date') { $element->setImage($this->getSkinUrl('images/calendar.gif')); $element->setFormat(Mage::app()->getLocale()->getDateFormatWithLongYear()); } else { if ($inputType == 'multiline') { $element->setLineCount($attribute->getMultilineCount()); } } } } } } $this->setForm($form); return $this; }