/** * {@inheritdoc} */ public function toHtml() { if (!$this->config->isEnabled()) { return ''; } return parent::toHtml(); }
/** * Retrieve Element HTML fragment * * @return string */ public function getElementHtml() { if (is_null($this->getValue())) { $this->setValue(\Magento\Catalog\Model\Product\Attribute\Source\Msrp\Type\Price::TYPE_USE_CONFIG); } return parent::getElementHtml(); }
/** * @return string */ public function getHtml() { if (!$this->getValue() || 1 != $this->getValue()) { $element = $this->getForm()->getElement($this->_getSpecificCountryElementId()); $element->setDisabled('disabled'); } return parent::getHtml(); }
/** * Constructor helper * * @return void */ public function _construct() { parent::_construct(); /* $options = array_intersect(array_combine($this->_defaultOptions, $this->_defaultOptions), $this->getOptions()); $this->setOptions($options); */ $this->setCssClass('element-' . self::CONTROL_TYPE); }
/** * Retrieve element html * * @return string */ public function getElementHtml() { $value = $this->getValue(); if ($value == '') { $this->setValue($this->_getValueFromConfig()); } $html = parent::getElementHtml(); $htmlId = 'use_config_' . $this->getHtmlId(); $checked = $value == '' ? ' checked="checked"' : ''; $disabled = $this->getReadonly() ? ' disabled="disabled"' : ''; $html .= '<input id="' . $htmlId . '" name="product[' . $htmlId . ']" ' . $disabled . ' value="1" ' . $checked; $html .= ' onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox" />'; $html .= ' <label for="' . $htmlId . '">' . __('Use Config Settings') . '</label>'; $html .= '<script type="text/javascript">toggleValueElements($(\'' . $htmlId . '\'), $(\'' . $htmlId . '\').parentNode);</script>'; return $html; }
/** * Retrieve Element HTML fragment * * @return string */ public function getElementHtml() { $elementDisabled = $this->getDisabled() == 'disabled'; $disabled = false; if (!$this->getValue() || $elementDisabled) { $this->setData('disabled', 'disabled'); $disabled = true; } $html = parent::getElementHtml(); $htmlId = 'use_config_' . $this->getHtmlId(); $html .= '<input id="' . $htmlId . '" name="use_config[]" value="' . $this->getId() . '"'; $html .= $disabled ? ' checked="checked"' : ''; if ($this->getReadonly() || $elementDisabled) { $html .= ' disabled="disabled"'; } $html .= ' onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox" />'; $html .= ' <label for="' . $htmlId . '" class="normal">' . __('Use Config Settings') . '</label>'; $html .= '<script>require(["prototype"], function(){toggleValueElements($(\'' . $htmlId . '\'), $(\'' . $htmlId . '\').parentNode);});</script>'; return $html; }
/** * Set name to quantity element in addition to current element * * @param string $name * @return void */ public function setName($name) { $this->_qty->setName($name . '[qty]'); parent::setName($name . '[is_in_stock]'); }
/** * Prepare default SELECT values * @return void */ protected function _construct() { parent::_construct(); $this->setValues([['label' => __('No'), 'value' => '0'], ['label' => __('Yes'), 'value' => 1]]); }
/** * @return void */ protected function _construct() { parent::_construct(); $this->setValues(array(array('label' => __('No'), 'value' => 0), array('label' => __('Yes'), 'value' => 1))); }