本文整理汇总了PHP中Varien_Event_Observer::getForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getForm方法的具体用法?PHP Varien_Event_Observer::getForm怎么用?PHP Varien_Event_Observer::getForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adminhtmlBlockSalesruleActionsPrepareform
/**
* Add a new simple action to the salesrule in the backen. In the combo-box
* you can now select 'Add a Gift' as one possible result of the given rule
* evaluation positive. Additionally you have to enter a sku of the gift that
* you want to make.
*
* @param Varien_Event_Observer $observer
*/
public function adminhtmlBlockSalesruleActionsPrepareform($observer)
{
$field = $observer->getForm()->getElement('simple_action');
$options = $field->getValues();
$options[] = array('value' => C4B_Freeproduct_Model_Consts::ADD_GIFT_ACTION, 'label' => Mage::helper('freeproduct')->__('Add a Gift'));
$field->setValues($options);
$fieldset = $observer->getForm()->getElement('action_fieldset');
$fieldset->addField('gift_sku', 'text', array('name' => 'gift_sku', 'label' => Mage::helper('freeproduct')->__('Gift SKU'), 'title' => Mage::helper('freeproduct')->__('Gift SKU'), 'note' => Mage::helper('freeproduct')->__('Enter the SKU of the gift that should be added to the cart')));
}
示例2: handleFormCreation
/**
* Process sales rule form creation
* @param Varien_Event_Observer $observer
*/
public function handleFormCreation($observer)
{
$actionsSelect = $observer->getForm()->getElement('simple_action');
if ($actionsSelect) {
$actionsSelect->setValues(array_merge($actionsSelect->getValues(), Mage::helper('amrules')->getDiscountTypes()));
}
$actionsSelect->setOnchange('ampromo_hide()');
//ampromo is correct name
$fldSet = $observer->getForm()->getElement('action_fieldset');
if ('true' != (string) Mage::getConfig()->getNode('modules/Amasty_Promo/active')) {
$fldSet->addField('promo_sku', 'text', array('name' => 'promo_sku', 'label' => Mage::helper('amrules')->__('Promo Items'), 'note' => Mage::helper('amrules')->__('Comma separated list of the SKUs')), 'discount_amount');
}
$fldSet->addField('promo_cats', 'text', array('name' => 'promo_cats', 'label' => Mage::helper('amrules')->__('Promo Categories'), 'note' => Mage::helper('amrules')->__('Comma separated list of the category ids')), 'discount_amount');
return $this;
}
示例3: removeActionsFieldset
public function removeActionsFieldset(Varien_Event_Observer $observer)
{
if (Mage::app()->getRequest()->getControllerModule() === Mage::helper('autobuypromotions')->getControllerModule()) {
$form = $observer->getForm();
$form->getElements()->remove('actions_fieldset');
}
}
示例4: handleFormCreation
/**
* Process sales rule form creation
* @param Varien_Event_Observer $observer
*/
public function handleFormCreation($observer)
{
$actionsSelect = $observer->getForm()->getElement('simple_action');
if ($actionsSelect) {
$vals = $actionsSelect->getValues();
$vals[] = array('value' => 'ampromo_items', 'label' => Mage::helper('ampromo')->__('Auto add promo items with products'));
$vals[] = array('value' => 'ampromo_cart', 'label' => Mage::helper('ampromo')->__('Auto add promo items for the whole cart'));
$vals[] = array('value' => 'ampromo_product', 'label' => Mage::helper('ampromo')->__('Auto add the same product'));
$actionsSelect->setValues($vals);
$actionsSelect->setOnchange('ampromo_hide()');
$fldSet = $observer->getForm()->getElement('action_fieldset');
$fldSet->addField('ampromo_type', 'select', array('name' => 'ampromo_type', 'label' => Mage::helper('ampromo')->__('Type'), 'values' => array(0 => Mage::helper('ampromo')->__('All SKUs below'), 1 => Mage::helper('ampromo')->__('One of the SKUs below'))), 'discount_amount');
$fldSet->addField('promo_sku', 'text', array('name' => 'promo_sku', 'label' => Mage::helper('ampromo')->__('Promo Items'), 'note' => Mage::helper('ampromo')->__('Comma separated list of the SKUs')), 'ampromo_type');
}
return $this;
}
示例5: adminhtmlCmsPageEditTabMainPrepareForm
/**
* @param Varien_Event_Observer $observer
*/
public function adminhtmlCmsPageEditTabMainPrepareForm($observer)
{
/* @var $page Mage_Cms_Model_Page */
$page = Mage::registry('cms_page');
/* @var $form Varien_Data_Form */
$form = $observer->getForm();
/* @var $fieldset Varien_Data_Form_Element_Fieldset */
$fieldset = $form->getElement('base_fieldset');
$pageTypes = Mage::getSingleton('typecms/source_type')->toOptionArray();
$fieldset->addField('page_type', 'select', array('name' => 'page_type', 'label' => Mage::helper('typecms')->__('Page Type'), 'values' => $pageTypes));
$model = Mage::getModel('typecms/page')->load($page->getId());
if (!$model->getPageType()) {
$page->setPageType(Mage::getSingleton('typecms/source_type')->getDefaultValue());
$model->setPageType(Mage::getSingleton('typecms/source_type')->getDefaultValue());
} else {
$page->setPageType($model->getPageType());
}
$values = array();
foreach ($model->getFilteredData() as $key => $value) {
$values['typecms_' . $key] = $value;
}
$page->addData($values);
$pageTypeInstance = $model->getPageTypeInstance();
$pageTypeInstance->init($form, $model);
}
示例6: addRelatedPagesSelector
/**
* add related pages selector to cms page form
*
* @param Varien_Event_Observer $observer
* @return void
*/
public function addRelatedPagesSelector(Varien_Event_Observer $observer)
{
$id = Mage::app()->getFrontController()->getRequest()->getParam('page_id');
$form = $observer->getForm();
$fieldset = $form->addFieldset('related_pages', array('legend' => Mage::helper('cmsrelations')->__('Related Pages')));
$fieldset->addField('related_translations', 'multiselect', array('name' => 'related_translations[]', 'label' => Mage::helper('cmsrelations')->__('Same page in other languages'), 'title' => Mage::helper('cmsrelations')->__('Same page in other languages'), 'values' => Mage::getResourceModel('cmsrelations/page_collection')->toOptionIdArray($id)));
}
示例7: addFieldsToCmsMetaTagForm
/**
* event: adminhtml_cms_page_edit_tab_meta_prepare_form
* in: Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Meta::_prepareForm()
*
* @param $event Varien_Event_Observer
* @return void
*/
public function addFieldsToCmsMetaTagForm(Varien_Event_Observer $event)
{
$isElementDisabled = Mage::getSingleton('admin/session')->isAllowed('cms/page/save') ? false : true;
$form = $event->getForm();
/* @var $form Varien_Data_Form */
$fieldset = $form->addFieldset('meta_seo', array('legend' => Mage::helper('loewenstark_seo')->__('Meta Data for SEO'), 'class' => 'fieldset-wide'));
$fieldset->addField('meta_robots', 'select', array('name' => 'meta_robots', 'label' => Mage::helper('loewenstark_seo')->__('Robots Tag'), 'title' => Mage::helper('loewenstark_seo')->__('Robots Tag'), 'values' => Mage::getSingleton('loewenstark_seo/system_config_source_cms_robots')->toOptionArray(), 'disabled' => $isElementDisabled));
}
示例8: addCategoryCmsField
/**
* Add additional field for new CMS page attribute
*
* @param Varien_Event_Observer $observer
*/
public function addCategoryCmsField(Varien_Event_Observer $observer)
{
//get CMS model with data
$model = Mage::registry('cms_page');
//get form instance
$form = $observer->getForm();
//create new custom fieldset 'extcms_content_fieldset'
$fieldset = $form->addFieldset('extcms_content_fieldset', array('legend' => Mage::helper('cms')->__('RaceChip Extension'), 'class' => 'fieldset-wide'));
//add new field
$fieldset->addField(RC_Extcms_Helper_Data::CATEGORY_ATTRIBUTE_NAME, 'text', array('name' => RC_Extcms_Helper_Data::CATEGORY_ATTRIBUTE_NAME, 'label' => Mage::helper('cms')->__(RC_Extcms_Helper_Data::CATEGORY_ATTRIBUTE_TITLE), 'title' => Mage::helper('cms')->__(RC_Extcms_Helper_Data::CATEGORY_ATTRIBUTE_TITLE), 'disabled' => false, 'value' => $model->getData(RC_Extcms_Helper_Data::CATEGORY_ATTRIBUTE_NAME)));
}
示例9: addFieldsToCmsMainForm
/**
* event: adminhtml_cms_page_edit_tab_main_prepare_form
* in: Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Main::_prepareForm()
*
* @param $event Varien_Event_Observer
* @return void
*/
public function addFieldsToCmsMainForm(Varien_Event_Observer $event)
{
$isElementDisabled = Mage::getSingleton('admin/session')->isAllowed('cms/page/save') ? false : true;
$form = $event->getForm();
$model = Mage::registry('cms_page');
/* @var $form Varien_Data_Form */
$fieldset = $form->addFieldset('cmsmenu', array('legend' => Mage::helper('cmsmenu')->__('CMS Menu Settings'), 'class' => 'fieldset-wide'));
$fieldset->addField('show_in_menu', 'select', array('name' => 'show_in_menu', 'label' => Mage::helper('cmsmenu')->__('Show in CMS Menu'), 'title' => Mage::helper('cmsmenu')->__('Show in CMS Menu'), 'required' => false, 'disabled' => $isElementDisabled, 'value' => $model->getMenuOrder(), 'options' => array(1 => Mage::helper('cmsmenu')->__('show'), 0 => Mage::helper('cmsmenu')->__('do not show'))));
$fieldset->addField('menu_group', 'text', array('name' => 'menu_group', 'label' => Mage::helper('cmsmenu')->__('Menu Group'), 'title' => Mage::helper('cmsmenu')->__('Menu Group'), 'required' => false, 'disabled' => $isElementDisabled, 'value' => $model->getMenuGroup()));
$fieldset->addField('name_in_menu', 'text', array('name' => 'name_in_menu', 'label' => Mage::helper('cmsmenu')->__('name in CMS Menu'), 'title' => Mage::helper('cmsmenu')->__('name in CMS Menu'), 'required' => false, 'disabled' => $isElementDisabled, 'value' => $model->getMenuOrder(), 'note' => 'Wenn dieses Feld leer gelassen wird, wird der Seitentitel verwendet'));
$fieldset->addField('menu_order', 'text', array('name' => 'menu_order', 'label' => Mage::helper('cmsmenu')->__('Position in CMS Menu'), 'title' => Mage::helper('cmsmenu')->__('Position in CMS Menu'), 'required' => false, 'disabled' => $isElementDisabled, 'value' => $model->getMenuOrder(), 'note' => 'Bitte eine Zahl eingeben'));
}
示例10: pageAdminEditTabDesignPrepareForm
public function pageAdminEditTabDesignPrepareForm(Varien_Event_Observer $observer)
{
$model = Mage::registry('cms_page');
$form = $observer->getForm();
$fieldset = $form->addFieldset('ebayenterprise_design_fieldset', array('legend' => Mage::helper('cms')->__('CMS Asset Includes'), 'class' => 'fieldset-wide'), '^');
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig();
$codeEditorTranslator = new CodeEditorTranslator($wysiwygConfig->getTranslator());
$wysiwygConfig->setTranslator($codeEditorTranslator);
$wysiwygConfig->setAddWidgets(false);
$fieldset->addField('head_assets', 'editor', array('name' => 'head_assets', 'label' => Mage::helper('cms')->__('HTML for <head>'), 'title' => Mage::helper('cms')->__('HTML for <head>'), 'value' => $model->getHeadAssets(), 'class' => 'code-editor', 'style' => EbayEnterprise_CmsAssets_Helper_Data::EDITOR_STYLE, 'config' => $wysiwygConfig, 'wysiwyg' => false));
$fieldset->addField('end_body_assets', 'editor', array('name' => 'end_body_assets', 'label' => Mage::helper('cms')->__('HTML for end of <body>'), 'title' => Mage::helper('cms')->__('HTML for end of <body>'), 'value' => $model->getEndBodyAssets(), 'class' => 'code-editor', 'style' => EbayEnterprise_CmsAssets_Helper_Data::EDITOR_STYLE, 'config' => $wysiwygConfig, 'wysiwyg' => false));
}
示例11: addCmsFields
public function addCmsFields(Varien_Event_Observer $observer)
{
$model = Mage::registry('cms_page');
$form = $observer->getForm();
$fieldset = $form->addFieldset('modulismo_content_fieldset', array('legend' => Mage::helper('cmsmenu')->__('Custom'), 'class' => 'fieldset-wide'));
$include_in_menu_options = Mage::getSingleton('cmsmenu/cms_includeinmenu')->getOptionArray();
$fieldset->addField('include_in_menu', 'select', array('name' => 'include_in_menu', 'label' => Mage::helper('cmsmenu')->__('Include In Navigation Menu'), 'title' => Mage::helper('cmsmenu')->__('Include In Navigation Menu'), 'disabled' => false, 'values' => $include_in_menu_options, 'value' => $model->getIncludeInMenu()));
$menu_level_options = Mage::getSingleton('cmsmenu/cms_menulevel')->getOptionArray();
$fetcher = Mage::helper("adminhtml")->getUrl("cmsmenu/adminhtml_cmsmenu/typefetcher/");
$fieldset->addField('menu_level', 'select', array('name' => 'menu_level', 'label' => Mage::helper('cmsmenu')->__('Navigation Menu Level'), 'title' => Mage::helper('cmsmenu')->__('Navigation Menu Level'), 'disabled' => false, 'onchange' => 'typeFetcher(\'' . $fetcher . '\')', 'values' => $menu_level_options, 'value' => $model->getMenuLevel()));
$fieldset->addField('parent_node', 'select', array('name' => 'parent_node', 'label' => Mage::helper('cmsmenu')->__('Parent Node'), 'title' => Mage::helper('cmsmenu')->__('Parent Node'), 'disabled' => false, 'value' => $model->getParentNode()));
}
示例12: onAdminhtmlCatalogProductEditPrepareForm
/**
* Event observer for when the catalog product edit page form is prepared.
* The form fieldset renderer widget template is overridden here for the
* "SizeMe Measurements" tab only. This is done to inject additional content
* to the config page.
*
* Event 'adminhtml_catalog_product_edit_prepare_form'.
*
* @param Varien_Event_Observer $observer the event observer.
*
* @return SizeMe_Measurements_Model_Observer
*/
public function onAdminhtmlCatalogProductEditPrepareForm(Varien_Event_Observer $observer)
{
/** @var Varien_Data_Form $form */
$form = $observer->getForm();
foreach ($form->getElements() as $fieldset) {
/** @var Varien_Data_Form_Element_Fieldset $fieldset */
if ($fieldset->getData('legend') === SizeMe_Measurements_Helper_Data::ATTRIBUTE_GROUP_NAME) {
/** @var Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset $renderer */
$renderer = $form->getFieldsetRenderer();
$renderer->setTemplate('sizememeasurements/widget/form/renderer/fieldset.phtml');
}
}
return $this;
}
示例13: showPrices
/**
* Event fired to show the prices form on product edit
* @param Varien_Event_Observer $observer
*/
public function showPrices(Varien_Event_Observer $observer)
{
$form = $observer->getForm();
if ($reservationPrices = $form->getElement('res_prices')) {
$reservationPrices->setRenderer(Mage::getSingleton('core/layout')->createBlock('payperrentals/adminhtml_catalog_product_edit_tab_payperrentals_reservationprices'));
}
}
示例14: addFieldToAttributeEditForm
/**
* Hook that allows us to edit the form that is used to create and/or edit attributes.
* @param Varien_Event_Observer $observer
*/
public function addFieldToAttributeEditForm($observer)
{
// Add an extra field to the base fieldset:
$fieldset = $observer->getForm()->getElement('base_fieldset');
$fieldset->addField('description', 'editor', array('name' => 'description', 'label' => Mage::helper('core')->__('Description'), 'title' => Mage::helper('core')->__('Description'), 'wysiwyg' => true, 'required' => false, 'style' => 'width: 600px;'));
}
示例15: addFieldToAttributeEditForm
/**
* Hook that allows us to edit the form that is used to create and/or edit attributes.
* @param Varien_Event_Observer $observer
*/
public function addFieldToAttributeEditForm($observer)
{
// Add an extra field to the base fieldset:
$fieldset = $observer->getForm()->getElement('base_fieldset');
$fieldset->addField('tooltip', 'text', array('name' => 'tooltip', 'label' => Mage::helper('core')->__('Tooltip'), 'title' => Mage::helper('core')->__('Tooltip')));
}