/** * Add Weight Switcher radio-button element html to weight field * * @return string */ public function getElementHtml() { if (!$this->getForm()->getDataObject()->getTypeInstance()->hasWeight()) { $this->weightSwitcher->setValue(WeightResolver::HAS_NO_WEIGHT); } if ($this->getDisabled()) { $this->weightSwitcher->setDisabled($this->getDisabled()); } return '<div class="admin__field-control weight-switcher">' . '<div class="admin__control-switcher" data-role="weight-switcher">' . $this->weightSwitcher->getLabelHtml() . '<div class="admin__field-control-group">' . $this->weightSwitcher->getElementHtml() . '</div>' . '</div>' . '<div class="admin__control-addon">' . parent::getElementHtml() . '<label class="admin__addon-suffix" for="' . $this->getHtmlId() . '"><span>' . $this->directoryHelper->getWeightUnit() . '</span></label>' . '</div>' . '</div>'; }