当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Data_Form_Element_Hidden::getElementHtml方法代码示例

本文整理汇总了PHP中Varien_Data_Form_Element_Hidden::getElementHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Hidden::getElementHtml方法的具体用法?PHP Varien_Data_Form_Element_Hidden::getElementHtml怎么用?PHP Varien_Data_Form_Element_Hidden::getElementHtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Data_Form_Element_Hidden的用法示例。


在下文中一共展示了Varien_Data_Form_Element_Hidden::getElementHtml方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepareElementHtml

    /**
     * @param Varien_Data_Form_Element_Abstract $element
     * @return Varien_Data_Form_Element_Abstract
     */
    public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
    {
        $this->_init($element);
        $strTrFunctionJs = '';
        if (!$this->_isStrtrAdded) {
            $strTrFunctionJs = '
                <script type="text/javascript">//<![CDATA[
                var extendix_strtr = function (str, from, to) {
                    var out = "", i, m, p;
                        for (i = 0, m = str.length; i < m; i++) {
                            p = from.indexOf(str.charAt(i));
                            if (p >= 0) {
                            out = out + to.charAt(p);
                        } else {
                            out += str.charAt(i);
                        }
                    }
                    return out;
                };
                //]]></script>
            ';
            $this->_isStrtrAdded = true;
        }
        $extraJsHtml = $strTrFunctionJs . '
            <script type="text/javascript">//<![CDATA[

                new Form.Element.Observer(
                  \'' . $this->_dummyFieldInput->getHtmlId() . '\',
                  0.2,  // 200 milliseconds
                  function(el, value) {
                    var regex = new RegExp(\'/\\\\___directive\\/([^\\/]+)\\/\');
                    var imagePathBase64 = regex.exec(value)[1];
                    var dirtyImagePath = Base64.decode(extendix_strtr(imagePathBase64, "-_,", "+/="));
                    dirtyImagePath = dirtyImagePath.replace(\'{{media url="\',\'\');
                    var relativeImagePath = dirtyImagePath.replace(\'"}}\', \'\');

                    $(\'' . $this->_fieldInput->getHtmlId() . '\').value = relativeImagePath;

                    //Disable Insert Button
                    $(\'' . $this->_imageChooserButton->getHtmlId() . '\').writeAttribute(\'disabled\', true);
                    $(\'' . $this->_imageChooserButton->getHtmlId() . '\').addClassName(\'disabled\');

                    //Enable Remove Button
                    $(\'' . $this->_imageRemoveButton->getHtmlId() . '\').writeAttribute(\'disabled\', false);
                    $(\'' . $this->_imageRemoveButton->getHtmlId() . '\').removeClassName(\'disabled\');

                    //Display new image
                    $(\'' . $element->getHtmlId() . self::IMAGE_PREVIEW_SUFFIX . '\').parentNode.href = \'/media/\' + relativeImagePath;
                    $(\'' . $element->getHtmlId() . self::IMAGE_PREVIEW_SUFFIX . '\').src = \'/media/\' + relativeImagePath;
                    $(\'' . $element->getHtmlId() . self::IMAGE_PREVIEW_SUFFIX . '\').title = relativeImagePath;
                    $(\'' . $element->getHtmlId() . self::IMAGE_PREVIEW_SUFFIX . '\').alt = relativeImagePath;
                    $(\'' . $element->getHtmlId() . self::IMAGE_PREVIEW_SUFFIX . '\').parentNode.removeClassName(\'no-display\');
                  }
                );
            //]]></script>
        ';
        $element->setData('after_element_html', $this->_fieldInput->getElementHtml() . $this->_dummyFieldInput->getElementHtml() . $this->_getPreviewHtml($element) . $this->_imageChooserButton->toHtml() . $this->_imageRemoveButton->toHtml() . $extraJsHtml);
        return $element;
    }
开发者ID:Rizsti,项目名称:Extendix_AdminFormChooserButton,代码行数:63,代码来源:ImageChooser.php

示例2: _toHtml

 protected function _toHtml()
 {
     $element = $this->getElement();
     /* @var $fieldset Varien_Data_Form_Element_Fieldset */
     $fieldset = $element->getForm()->getElement($this->getFieldsetId());
     $chooserId = $this->getUniqId();
     $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('');
     }
     $buttons = $config->getButtons();
     $chooseButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setId($chooserId . 'control')->setClass('btn-chooser')->setLabel($buttons['open'])->setOnclick($chooserId . '.choose()');
     $delButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setId($chooserId . 'del_control')->setClass('btn-del-img')->setLabel(' Delete image ')->setOnclick('del(this)');
     $chooser->setData('after_element_html', $hiddenHtml . $chooseButton->toHtml() . $delButton->toHtml());
     // render label and chooser scripts
     $configJson = Mage::helper('core')->jsonEncode($config->getData());
     return '
         <label class="widget-option-label" id="' . $chooserId . 'label">' . ($this->getLabel() ? $this->getLabel() : Mage::helper('widget')->__('Not Selected')) . '</label>
         <div id="' . $chooserId . 'advice-container" class="hidden"></div>
         <script type="text/javascript">
             ' . $chooserId . ' = new WysiwygWidget.chooser("' . $chooserId . '", "' . $this->getSourceUrl() . '", ' . $configJson . ');
         </script>
     ';
 }
开发者ID:programmerrahul,项目名称:vastecom,代码行数:33,代码来源:Widget.php

示例3: prepareElementHtml

 /**
  * Prepare chooser element HTML
  *
  * @param Varien_Data_Form_Element_Abstract $element Form Element
  * @return Varien_Data_Form_Element_Abstract
  */
 public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $this->_elementValueId = "{$element->getId()}";
     $this->_selectedBanners = explode(',', $element->getValue());
     //Create hidden field that store selected banner ids
     $hidden = new Varien_Data_Form_Element_Hidden($element->getData());
     $hidden->setId($this->_elementValueId)->setForm($element->getForm());
     $hiddenHtml = $hidden->getElementHtml();
     $element->setValue('')->setValueClass('value2');
     $element->setData('after_element_html', $hiddenHtml . $this->toHtml());
     return $element;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:18,代码来源:Chooser.php

示例4: getElementHtml

 /**
  * Return checkbox html with hidden field for correct config values
  *
  * @param string $elementId
  * @return string
  */
 public function getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     if ($element->getType() != 'checkbox') {
         return $element->getElementHtml();
     }
     $configValue = (string) $element->getValue();
     if ($configValue) {
         $element->setChecked(true);
     } else {
         $element->setValue('1');
     }
     if ($element->getCanUseDefaultValue() && $element->getInherit()) {
         $element->setDisabled(true);
     }
     $hidden = new Varien_Data_Form_Element_Hidden(array('html_id' => $element->getHtmlId() . '_value', 'name' => $element->getName(), 'value' => '0'));
     $hidden->setForm($element->getForm());
     return $hidden->getElementHtml() . $element->getElementHtml();
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:24,代码来源:Global.php

示例5: getElementHtml

 public function getElementHtml()
 {
     $element = $this->getElement();
     if (!$element->getValue()) {
         return parent::getElementHtml();
     }
     $element->setOnkeyup("onUrlkeyChanged('" . $element->getHtmlId() . "')");
     $element->setOnchange("onUrlkeyChanged('" . $element->getHtmlId() . "')");
     $data = array('name' => $element->getData('name') . '_create_redirect', 'disabled' => true);
     $hidden = new Varien_Data_Form_Element_Hidden($data);
     $hidden->setForm($element->getForm());
     $storeId = $element->getForm()->getDataObject()->getStoreId();
     $data['html_id'] = $element->getHtmlId() . '_create_redirect';
     $data['label'] = Mage::helper('catalog')->__('Create Permanent Redirect for old URL');
     $data['value'] = $element->getValue();
     $data['checked'] = Mage::helper('catalog')->shouldSaveUrlRewritesHistory($storeId);
     $checkbox = new Varien_Data_Form_Element_Checkbox($data);
     $checkbox->setForm($element->getForm());
     return parent::getElementHtml() . '<br/>' . $hidden->getElementHtml() . $checkbox->getElementHtml() . $checkbox->getLabelHtml();
 }
开发者ID:par-orillonsoft,项目名称:app,代码行数:20,代码来源:Urlkey.php

示例6: _toHtml

    /**
     * Return chooser HTML and init scripts
     *
     * @return string
     */
    protected function _toHtml()
    {
        $element = $this->getElement();
        /* @var $fieldset Varien_Data_Form_Element_Fieldset */
        $fieldset = $element->getForm()->getElement($this->getFieldsetId());
        $chooserId = $this->getUniqId();
        $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('');
        }
        $buttons = $config->getButtons();
        $chooseButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setId($chooserId . 'control')->setClass('btn-chooser')->setLabel($buttons['open'])->setOnclick($chooserId . '.choose()')->setDisabled($element->getReadonly());
        $chooser->setData('after_element_html', $hiddenHtml . $chooseButton->toHtml());
        // render label and chooser scripts
        $configJson = Mage::helper('core')->jsonEncode($config->getData());
        return '
            <label class="widget-option-label" id="' . $chooserId . 'label">' . ($this->getLabel() ? $this->getLabel() : Mage::helper('widget')->__('Not Selected')) . '</label>
            <div id="' . $chooserId . 'advice-container" class="hidden"></div>
            <script type="text/javascript">//<![CDATA[
                (function() {
                    var instantiateChooser = function() {
                        window.' . $chooserId . ' = new WysiwygWidget.chooser(
                            "' . $chooserId . '",
                            "' . $this->getSourceUrl() . '",
                            ' . $configJson . '
                        );
                        if ($("' . $chooserId . 'value")) {
                            $("' . $chooserId . 'value").advaiceContainer = "' . $chooserId . 'advice-container";
                        }
                    }

                    if (document.loaded) { //allow load over ajax
                        instantiateChooser();
                    } else {
                        document.observe("dom:loaded", instantiateChooser);
                    }
                })();
            //]]></script>
        ';
    }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:54,代码来源:Chooser.php

示例7: getElementHtml

 /**
  * Return element html code
  *
  * @return string
  */
 public function getElementHtml()
 {
     $imageUrl = $this->_helperData->escapeHtml($this->_getImageUrl($this->getValue()));
     $htmlId = $this->_helperData->escapeHtml($this->getHtmlId());
     $uploadUrl = $this->_helperData->escapeHtml($this->_getUploadUrl());
     $html = '<input id="' . $htmlId . '_upload" type="file" name="image" ' . 'data-url="' . $uploadUrl . '" style="display: none;" />' . parent::getElementHtml() . '<img align="left" src="' . $imageUrl . '" id="' . $htmlId . '_image"' . ' title="' . $imageUrl . '" alt="' . $imageUrl . '" class="base-image-uploader"' . ' onclick="jQuery(\'#' . $htmlId . '_upload\').trigger(\'click\')"/>';
     $html .= $this->_getJs();
     return $html;
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:14,代码来源:BaseImage.php

示例8: _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>';
 }
开发者ID:Aerotexextintores,项目名称:novosite,代码行数:58,代码来源:Chooser.php

示例9: _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>';
 }
开发者ID:omusico,项目名称:losvineros,代码行数:43,代码来源:Chooser.php


注:本文中的Varien_Data_Form_Element_Hidden::getElementHtml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。