Example #1
0
 /**
  * Initialize form elements
  *
  * @param Configuration $controlsConfig
  * @param Form $form
  * @return $this
  */
 protected function _initFormElements($controlsConfig, $form)
 {
     $hintMessage = __('Please enter values for height and width.' . ' Use the chain icon if you want height and width to match.' . ' Be sure to see how it looks in your store.' . ' You may need to update your custom CSS file.');
     $form->addField('information_hint', 'note', ['after_element_html' => '<p class="note">' . $hintMessage . '</p>']);
     $whiteBorder = $controlsConfig->getControlData('product_image_border');
     if ($whiteBorder) {
         $this->_addWhiteBorderElement($whiteBorder);
     }
     $controls = $controlsConfig->getAllControlsData();
     foreach ($controls as $name => $control) {
         if ($control['type'] != 'image-sizing') {
             continue;
         }
         $this->_addImageSizeFieldset($name, $control);
     }
     $fieldset = $form->addFieldset('save_image_sizing_fieldset', ['name' => 'save_image_sizing_fieldset', 'fieldset_type' => 'field', 'class' => 'save_image_sizing']);
     $this->_addElementTypes($fieldset);
     if ($whiteBorder || $controls) {
         $fieldset->addField('save_image_sizing', 'button_button', ['name' => 'save_image_sizing', 'title' => __('Update'), 'value' => __('Update'), 'data-mage-init' => $this->escapeHtml(json_encode(['button' => ['event' => 'saveForm', 'target' => 'body']]))]);
     }
     return $this;
 }