Ejemplo n.º 1
0
 /**
  * @param \Magento\Catalog\Block\Adminhtml\Category\Tab\Attributes $subject
  * @param \Magento\Catalog\Block\Adminhtml\Category\Tab\Attributes $result
  *
  * @return \Magento\Catalog\Block\Adminhtml\Category\Tab\Attributes
  */
 public function afterSetForm(\Magento\Catalog\Block\Adminhtml\Category\Tab\Attributes $subject, \Magento\Catalog\Block\Adminhtml\Category\Tab\Attributes $result)
 {
     $form = $subject->getForm();
     $fieldset = $form->getElements()[0];
     $field = $form->getElement('url_key');
     if ($field) {
         if ($subject->getCategory()->getLevel() == 1) {
             $fieldset->removeField('url_key');
             $fieldset->addField('url_key', 'hidden', ['name' => 'url_key', 'value' => $subject->getCategory()->getUrlKey()]);
         } else {
             $field->setRenderer($subject->getLayout()->createBlock('Magento\\CatalogUrlRewrite\\Block\\UrlKeyRenderer'));
         }
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function setForm(\Magento\Framework\Data\Form $form)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setForm');
     if (!$pluginInfo) {
         return parent::setForm($form);
     } else {
         return $this->___callPlugins('setForm', func_get_args(), $pluginInfo);
     }
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function offsetGet($offset)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'offsetGet');
     if (!$pluginInfo) {
         return parent::offsetGet($offset);
     } else {
         return $this->___callPlugins('offsetGet', func_get_args(), $pluginInfo);
     }
 }