本文整理汇总了PHP中Varien_Data_Form_Element_Hidden::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Hidden::getName方法的具体用法?PHP Varien_Data_Form_Element_Hidden::getName怎么用?PHP Varien_Data_Form_Element_Hidden::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form_Element_Hidden
的用法示例。
在下文中一共展示了Varien_Data_Form_Element_Hidden::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _toHtml
/**
* Return chooser HTML and init scripts
*
* @return string
*/
protected function _toHtml()
{
if (is_null(Mage::registry('megamenu_adminhtml_widget_chooser'))) {
return parent::_toHtml();
}
//unregister
Mage::unregister('megamenu_adminhtml_widget_chooser');
$element = $this->getElement();
$htmlIdPrefix = $element->getForm()->getHtmlIdPrefix();
/* @var $fieldset Varien_Data_Form_Element_Fieldset */
// $fieldset = $element->getForm()->getElement($this->getFieldsetId());// getForm >> getFieldset >> field
$chooserId = $this->getUniqId();
// echo $chooserId;die; //options_fieldset_megamenu_sm_megamenu_product_id44c9ff3c66b2985cea68c24a0e23ef5b
// $sourceUrl chua' megamenu gay loi khi ajax :http://127.0.0.1/mage1510/index.php/*megamenu*/catalog_product_widget/chooser/uniq_id/options_fieldset_megamenu_id_pathc0244322fc3e6acc4edb
$admin = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
$SourceUrl = str_replace("/megamenu/", "/{$admin}/", $this->getSourceUrl());
$SourceUrl = str_replace("/uniq_id/", "/uniq_id/" . $htmlIdPrefix, $SourceUrl);
$this->setSourceUrl($SourceUrl);
$config = $this->getConfig();
// add chooser element to fieldset
// $chooser = $fieldset->addField('chooser' . $element->getId(), 'note', array(
// 'label' => $config->getLabel() ? $config->getLabel() : '',
// 'value_class' => 'value2',
// ));
$hiddenHtml = '';
if ($this->getHiddenEnabled()) {
$hidden = new Varien_Data_Form_Element_Hidden($element->getData());
$hidden->setId("{$chooserId}value")->setForm($element->getForm());
if ($element->getRequired()) {
$hidden->addClass('required-entry');
}
$hiddenHtml = $hidden->getElementHtml();
$element->setValue('');
}
// $config->getData() ;// array(1) { ["buttons"] => array(2) { ["open"] => string(17) "Select Product..." ["close"] => string(5) "Close" } }
$configJson = Mage::helper('core')->jsonEncode($config->getData());
$js = '
<script type="text/javascript">
' . $htmlIdPrefix . $chooserId . ' = new WysiwygWidget.chooser("' . $htmlIdPrefix . $chooserId . '", "' . $this->getSourceUrl() . '", ' . $configJson . ');
// $("' . $chooserId . 'value").advaiceContainer = "' . $chooserId . 'advice-container";
</script>
';
$buttons = $config->getButtons();
$chooseButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setId($htmlIdPrefix . $chooserId . 'control')->setClass('btn-chooser')->setLabel($buttons['open'])->setOnclick($htmlIdPrefix . $chooserId . '.choose();$$(\'.' . $hidden->getName() . '\')[0].id=\'\';$$(\'.data_type\')[0].id=\'' . $htmlIdPrefix . $chooserId . 'value\';');
// ->setOnclick($htmlIdPrefix.$chooserId.'.choose();$$(\'.'.$hidden->getName().'\')[0].name=$$(\'.data_type\')[0].name;');
// $chooser->setData('after_element_html', $hiddenHtml . $chooseButton->toHtml().$js);
// render label and chooser scripts
$configJson = Mage::helper('core')->jsonEncode($config->getData());
return '<div id="' . $htmlIdPrefix . 'box_' . $chooserId . '">
<label style="background-color: #EEE2BE; float: left; font-size: 15px; height: 21px; width: 46%; margin-right:3px; overflow:hidden;" class="widget-option-label" id="' . $htmlIdPrefix . $chooserId . 'label">' . ($this->getLabel() ? $this->getLabel() : Mage::helper('widget')->__('Not Selected')) . '</label>
<div id="' . $htmlIdPrefix . $chooserId . 'advice-container" class="hidden"></div>
' . $hiddenHtml . $chooseButton->toHtml() . $js . '</div>';
}
示例2: _toHtml
/**
* Return chooser HTML and init scripts
*
* @return string
*/
protected function _toHtml()
{
if (is_null(Mage::registry('megamenu_adminhtml_widget_chooser'))) {
return parent::_toHtml();
}
Mage::unregister('megamenu_adminhtml_widget_chooser');
$element = $this->getElement();
$htmlIdPrefix = $element->getForm()->getHtmlIdPrefix();
$chooserId = $this->getUniqId();
$admin = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
$SourceUrl = str_replace("/megamenu/", "/{$admin}/", $this->getSourceUrl());
$SourceUrl = str_replace("/uniq_id/", "/uniq_id/" . $htmlIdPrefix, $SourceUrl);
$this->setSourceUrl($SourceUrl);
$config = $this->getConfig();
$hiddenHtml = '';
if ($this->getHiddenEnabled()) {
$hidden = new Varien_Data_Form_Element_Hidden($element->getData());
$hidden->setId("{$chooserId}value")->setForm($element->getForm());
if ($element->getRequired()) {
$hidden->addClass('required-entry');
}
$hiddenHtml = $hidden->getElementHtml();
$element->setValue('');
}
$configJson = Mage::helper('core')->jsonEncode($config->getData());
$js = '
<script type="text/javascript">
' . $htmlIdPrefix . $chooserId . ' = new WysiwygWidget.chooser("' . $htmlIdPrefix . $chooserId . '", "' . $this->getSourceUrl() . '", ' . $configJson . ');
</script>
';
$buttons = $config->getButtons();
$chooseButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setId($htmlIdPrefix . $chooserId . 'control')->setClass('btn-chooser')->setLabel($buttons['open'])->setOnclick($htmlIdPrefix . $chooserId . '.choose();$$(\'.' . $hidden->getName() . '\')[0].id=\'\';$$(\'.data_type\')[0].id=\'' . $htmlIdPrefix . $chooserId . 'value\';');
$configJson = Mage::helper('core')->jsonEncode($config->getData());
return '<div id="' . $htmlIdPrefix . 'box_' . $chooserId . '">
<label style="background-color: #EEE2BE; float: left; font-size: 15px; height: 21px; width: 46%; margin-right:3px; overflow:hidden;" class="widget-option-label" id="' . $htmlIdPrefix . $chooserId . 'label">' . ($this->getLabel() ? $this->getLabel() : Mage::helper('widget')->__('Not Selected')) . '</label>
<div id="' . $htmlIdPrefix . $chooserId . 'advice-container" class="hidden"></div>
' . $hiddenHtml . $chooseButton->toHtml() . $js . '</div>';
}