예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function toHtml()
 {
     if (!$this->config->isEnabled()) {
         return '';
     }
     return parent::toHtml();
 }
예제 #2
0
파일: Price.php 프로젝트: aiesh/magento2
 /**
  * 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();
 }
예제 #3
0
 /**
  * @return string
  */
 public function getHtml()
 {
     if (!$this->getValue() || 1 != $this->getValue()) {
         $element = $this->getForm()->getElement($this->_getSpecificCountryElementId());
         $element->setDisabled('disabled');
     }
     return parent::getHtml();
 }
예제 #4
0
 /**
  * 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);
 }
예제 #5
0
파일: Config.php 프로젝트: aiesh/magento2
 /**
  * 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;
 }
예제 #6
0
 /**
  * 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;
 }
예제 #7
0
 /**
  * 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]');
 }
예제 #8
0
 /**
  * Prepare default SELECT values
  * @return void
  */
 protected function _construct()
 {
     parent::_construct();
     $this->setValues([['label' => __('No'), 'value' => '0'], ['label' => __('Yes'), 'value' => 1]]);
 }
예제 #9
0
파일: Boolean.php 프로젝트: aiesh/magento2
 /**
  * @return void
  */
 protected function _construct()
 {
     parent::_construct();
     $this->setValues(array(array('label' => __('No'), 'value' => 0), array('label' => __('Yes'), 'value' => 1)));
 }