Exemplo n.º 1
0
    public function render(AbstractElement $element)
    {
        $element->unsScope();
        $element->unsCanUseWebsiteValue();
        $element->unsCanUseDefaultValue();
        $element->setValue(__('Update'));
        $element->setData('onclick', 'javascript:geoIpUpdate(); return false;');
        $element->setData('class', 'action-default');
        $element->setData('after_element_js', '<script type="application/javascript">
    require(["jquery"], function($){
        window.geoIpUpdate = function() {
            $.getJSON(
                "' . $this->getUrl('tobai_geoip2/database/update') . '",
                function(data) {
                    if (data.status_info) {
                        $("#row_tobai_geoip2_database_status .value").html(data.status_info);
                    }
                }
            );
        };

        $(document).bind("ajaxSend", function() {
            $("body").trigger("processStart");
        });

        $(document).bind("ajaxComplete", function() {
            $("body").trigger("processStop");
        });
    });
</script>');
        return parent::render($element);
    }
Exemplo n.º 2
0
 /**
  * @param AbstractElement $element
  * @return string
  */
 public function render(AbstractElement $element)
 {
     if (!$element instanceof Select || empty($element->getData('values'))) {
         return '';
     }
     return parent::render($element);
 }
Exemplo n.º 3
0
 /**
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     if ($this->getRequest()->getParam('website') != '') {
         $priceScope = $this->_scopeConfig->getValue(\Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
         if ($priceScope == \Magento\Store\Model\Store::PRICE_SCOPE_GLOBAL) {
             return '';
         }
     }
     return parent::render($element);
 }
Exemplo n.º 4
0
 public function testRenderInheritCheckbox()
 {
     $this->_elementMock->expects($this->any())->method('getInherit')->will($this->returnValue(true));
     $this->_elementMock->expects($this->any())->method('getCanUseWebsiteValue')->will($this->returnValue(true));
     $this->_elementMock->expects($this->any())->method('getCanUseDefaultValue')->will($this->returnValue(true));
     $this->_elementMock->expects($this->once())->method('setDisabled')->with(true);
     $expected = '<td class="use-default">';
     $expected .= '<input id="' . $this->_testData['htmlId'] . '_inherit" name="' . $this->_testData['name'] . '[inherit]" type="checkbox" value="1"' . ' class="checkbox config-inherit" checked="checked"' . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> ';
     $expected .= '<label for="' . $this->_testData['htmlId'] . '_inherit" class="inherit">Use Website</label>';
     $actual = $this->_object->render($this->_elementMock);
     $this->assertContains($expected, $actual);
 }
Exemplo n.º 5
0
 /**
  * Render text
  *
  * @param  \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     //		$html='<li class="notice-msg">
     //
     //                                        * <a href="https://docs.mageplaza.com/blog-m2/" target="_blank">User Guide</a> <br>
     //                                        * <a href="https://mageplaza.freshdesk.com/support/discussions/topics/new?forum_id=6000241371" target="_blank">Report a problem</a> <br>
     //                                        * Your default blog URL <strong>domain.com/blog/</strong> <br>
     //                                        * Atom Feed <strong>domain.com/blog/post/rss/</strong> <br>
     //                                        * Sitemap <strong>domain.com/sitemap/blog.xml</strong> <br>
     //
     //                            </li>';
     //		return $html;
     return parent::render($element);
 }
Exemplo n.º 6
0
 /**
  * Render country field considering request parameter
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $country = $this->getRequest()->getParam(StructurePlugin::REQUEST_PARAM_COUNTRY);
     if ($country) {
         $element->setValue($country);
     }
     if ($element->getCanUseDefaultValue()) {
         $this->_defaultCountry = $this->_scopeConfig->getValue(self::FIELD_CONFIG_PATH);
         if (!$this->_defaultCountry) {
             $this->_defaultCountry = $this->directoryHelper->getDefaultCountry();
         }
         if ($country) {
             $shouldInherit = $country == $this->_defaultCountry && $this->getRequest()->getParam(self::REQUEST_PARAM_DEFAULT_COUNTRY);
             $element->setInherit($shouldInherit);
         }
         if ($element->getInherit()) {
             $this->_defaultCountry = null;
         }
     }
     return parent::render($element);
 }
Exemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 public function render(AbstractElement $element)
 {
     $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
     return parent::render($element);
 }
Exemplo n.º 8
0
 /**
  * Unset some non-related element parameters
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
     return parent::render($element);
 }
Exemplo n.º 9
0
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $element->setDateFormat(\Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT);
     $element->setTimeFormat(null);
     return parent::render($element);
 }
Exemplo n.º 10
0
 /**
  * Retrieve HTML markup for given form element
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $element->setRenderer($this);
     return parent::render($element);
 }