/**
  * @return $this
  */
 protected function _prepareLayout()
 {
     $category = $this->getCategory();
     $categoryId = (int) $category->getId();
     // 0 when we create Category, otherwise some value for editing Category
     $this->setChild('tabs', $this->getLayout()->createBlock('Mageplaza\\Blog\\Block\\Adminhtml\\Category\\Edit\\Tabs', 'tabs'));
     // Save button
     $this->addButton('save', ['id' => 'save', 'label' => __('Save Category'), 'class' => 'save primary save-category', 'data_attribute' => ['mage-init' => ['Mageplaza_Blog/category/edit' => ['url' => $this->getSaveUrl(), 'ajax' => true]]]]);
     // Delete button
     if ($categoryId && !in_array($categoryId, $this->getRootIds())) {
         $this->addButton('delete', ['id' => 'delete', 'label' => __('Delete Category'), 'onclick' => "categoryDelete('" . $this->getUrl('mageplaza_blog/*/delete', ['_current' => true]) . "')", 'class' => 'delete']);
     }
     // Reset button
     $resetPath = $categoryId ? 'mageplaza_blog/*/edit' : 'mageplaza_blog/*/add';
     $this->addButton('reset', ['id' => 'reset', 'label' => __('Reset'), 'onclick' => "categoryReset('" . $this->getUrl($resetPath, ['_current' => true]) . "',false)", 'class' => 'reset']);
     return parent::_prepareLayout();
 }
 /**
  * Add buttons
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     $addUrl = $this->getUrl("*/*/new", ['_current' => true, 'category_id' => null, '_query' => false]);
     $this->addChild('add_sub_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Add Child Category'), 'onclick' => "addNew('" . $addUrl . "', false)", 'class' => 'add', 'id' => 'add_child_category_button', 'style' => $this->canAddChildCategory() ? '' : 'display: none;']);
     if ($this->canAddChildCategory()) {
         $this->addChild('add_root_button', 'Magento\\Backend\\Block\\Widget\\Button', ['label' => __('Add Root Category'), 'onclick' => "addNew('" . $addUrl . "', true)", 'class' => 'add', 'id' => 'add_root_category_button']);
     }
     return parent::_prepareLayout();
 }