Beispiel #1
0
 /**
  * Load Wysiwyg on demand and prepare layout
  *
  * @return void
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     if ($this->_catalogData->isModuleEnabled('Magento_Cms') && $this->_wysiwygConfig->isEnabled()) {
         $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
     }
 }
Beispiel #2
0
 /**
  * @return void
  */
 public function _prepareLayout()
 {
     parent::_prepareLayout();
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $form->setDataObject($this->getCategory());
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Custom Design')]);
     $this->_setFieldset($this->getCategory()->getDesignAttributes(), $fieldset);
     $form->addValues($this->getCategory()->getData());
     $form->setFieldNameSuffix('general');
     $this->setForm($form);
 }
Beispiel #3
0
 /**
  * @return void
  */
 public function _prepareLayout()
 {
     parent::_prepareLayout();
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('_general');
     $form->setDataObject($this->getCategory());
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => __('General Information')));
     if (!$this->getCategory()->getId()) {
         //            $fieldset->addField('path', 'select', array(
         //                'name'  => 'path',
         //                'label' => __('Parent Category'),
         //                'value' => base64_decode($this->getRequest()->getParam('parent')),
         //                'values'=> $this->_getParentCategoryOptions(),
         //                //'required' => true,
         //                //'class' => 'required-entry'
         //                ),
         //                'name'
         //            );
         $parentId = $this->getRequest()->getParam('parent');
         if (!$parentId) {
             $parentId = \Magento\Catalog\Model\Category::TREE_ROOT_ID;
         }
         $fieldset->addField('path', 'hidden', array('name' => 'path', 'value' => $parentId));
     } else {
         $fieldset->addField('id', 'hidden', array('name' => 'id', 'value' => $this->getCategory()->getId()));
         $fieldset->addField('path', 'hidden', array('name' => 'path', 'value' => $this->getCategory()->getPath()));
     }
     $this->_setFieldset($this->getCategory()->getAttributes(true), $fieldset);
     if ($this->getCategory()->getId()) {
         if ($this->getCategory()->getLevel() == 1) {
             $fieldset->removeField('url_key');
             $fieldset->addField('url_key', 'hidden', array('name' => 'url_key', 'value' => $this->getCategory()->getUrlKey()));
         }
     }
     $form->addValues($this->getCategory()->getData());
     $form->setFieldNameSuffix('general');
     $this->setForm($form);
 }
Beispiel #4
0
 /**
  * Prepare form before rendering HTML
  *
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function _prepareForm()
 {
     $group = $this->getGroup();
     $attributes = $this->getAttributes();
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('group_' . $group->getId());
     $form->setDataObject($this->getCategory());
     $fieldset = $form->addFieldset('fieldset_group_' . $group->getId(), ['legend' => __($group->getAttributeGroupName()), 'class' => 'fieldset-wide']);
     if ($this->getAddHiddenFields()) {
         if (!$this->getCategory()->getId()) {
             // path
             if ($this->getRequest()->getParam('parent')) {
                 $fieldset->addField('path', 'hidden', ['name' => 'path', 'value' => $this->getRequest()->getParam('parent')]);
             } else {
                 $fieldset->addField('path', 'hidden', ['name' => 'path', 'value' => 1]);
             }
         } else {
             $fieldset->addField('id', 'hidden', ['name' => 'id', 'value' => $this->getCategory()->getId()]);
             $fieldset->addField('path', 'hidden', ['name' => 'path', 'value' => $this->getCategory()->getPath()]);
         }
     }
     $this->_setFieldset($attributes, $fieldset);
     if ($this->getCategory()->getLevel() == 1) {
         $fieldset->removeField('custom_use_parent_settings');
     } else {
         if ($this->getCategory()->getCustomUseParentSettings()) {
             foreach ($this->getCategory()->getDesignAttributes() as $attribute) {
                 if ($element = $form->getElement($attribute->getAttributeCode())) {
                     $element->setDisabled(true);
                 }
             }
         }
         if ($element = $form->getElement('custom_use_parent_settings')) {
             $element->setData('onchange', 'onCustomUseParentChanged(this)');
         }
     }
     if ($this->getCategory()->hasLockedAttributes()) {
         foreach ($this->getCategory()->getLockedAttributes() as $attribute) {
             if ($element = $form->getElement($attribute)) {
                 $element->setReadonly(true, true);
             }
         }
     }
     if (!$this->getCategory()->getId()) {
         $this->getCategory()->setIncludeInMenu(1);
     }
     $form->addValues($this->getCategory()->getData());
     $this->_eventManager->dispatch('adminhtml_catalog_category_edit_prepare_form', ['form' => $form]);
     $form->setFieldNameSuffix('general');
     $this->setForm($form);
     return parent::_prepareForm();
 }
 /**
  * @return string
  */
 protected function _toHtml()
 {
     parent::_toHtml();
     return $this->getForm()->getElement('group_fields')->getChildrenHtml();
 }
Beispiel #6
0
 /**
  * @return void
  */
 protected function _construct()
 {
     parent::_construct();
     $this->setShowGlobalIcon(true);
 }
 /**
  * Prepare form before rendering HTML
  *
  * @return \Magento\Backend\Block\Widget\Form
  */
 protected function _prepareForm()
 {
     $this->_formHelper->addGoogleoptimizerFields($this->getForm(), $this->_getGoogleExperiment(), 'category_form');
     $this->getForm()->getElement('googleoptimizer_fields')->setData(['legend' => null]);
     return parent::_prepareForm();
 }
 /**
  * Prepare form before rendering HTML
  *
  * @return \Magento\Backend\Block\Widget\Form
  */
 protected function _prepareForm()
 {
     $this->_formHelper->addGoogleoptimizerFields($this->getForm(), $this->_getGoogleExperiment());
     return parent::_prepareForm();
 }