View Single Post
  #2  
Old 05-24-2021, 09:03 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: Adding Tabs to Admin Pages

As a matter of fact the tabs are handled differently. You can look at the code of the controller class for front page, and you will see that there is no method called getPages()


Instead the class View/Tabs/FrontPage.php has a method called defineTabs()
Code:
/** * @return array */ protected function defineTabs() { $tabs = []; if (Auth::getInstance()->isPermissionAllowed(Permission::ROOT_ACCESS) || Auth::getInstance()->isPermissionAllowed('manage front page')) { $tabs['front_page'] = [ 'weight' => 100, 'title' => static::t('Front page'), 'template' => 'front_page/body.twig', ]; } if (Auth::getInstance()->isPermissionAllowed('manage banners')) { $tabs['banner_rotation'] = [ 'weight' => 200, 'title' => static::t('Banner rotation'), 'template' => 'banner_rotation/body.twig', ]; } return $tabs; }
so you have to decorate this method. In case you have difficulty in finding out the right code, you can take a look at the following code in the class XLite/Module/CDev/FeaturedProducts/View/Tabs/FrontPage.php


Code:
/** * @return array */ protected function defineTabs() { $list = parent::defineTabs(); $list['featured_products'] = [ 'weight' => 300, 'title' => static::t('Featured products'), 'template' => 'modules/CDev/FeaturedProducts/featured_products.twig' , ]; return $list; }
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote