AbanteCart Community
AbanteCart Development => Development Help Needed => Topic started by: yonghan on June 30, 2015, 05:30:13 AM
-
Hi admins, I wonder if it's possible to hook extension edit page in order to create submenu when admin turn on an extension? Thanks
-
submenu where? on sf or admin side?
-
Sorry I didn't ask clearly. Submenu on admin side. Thanks.
-
you can look into two extensions inside distributive, i mean forms_manager and banner_manager. Both have install.php and uninstall.php that creates and removes menu item
-
I have looked at banner_manager and currently I'm using that approach for my extension, but I would like to create the submenu only when the extension is turned on and not installed. Is it possible to do that?
-
Currently, any installed/enabled extension is treated as enabled extension in admin. This is done on purpose to allow access to controllers even if extension is set to status OFF. In over words, this allows user to still edit custom extension settings or access pages with extension related data.
For instance, In case of payment extensions, you still what to see payment history even if extension is disabled and no longer available in a storefront.
Regarding you question. We are looking into solution that will be logical in 1.2.3.
I will update.
-
well.. we added additional hook call for affecting on data of admin menu into v1.2.3 ( see details https://github.com/abantecart/abantecart-src/commit/804c6b35007e91b47487f1956c815405cd8548d9)
then in your extension hook-file you can add this method
public function onControllerCommonMenu_ProcessData(){
$that = $this->baseObject;
if(!$that->config->get('your_extension_txt_id_status')){
$items = $that->data['menu_items'];
foreach ($items as $k=>$item) {
if($item['item_id']=='your_extension_txt_id_menu_item_id'){
unset($items[$k]);
break;
}
}
$that->data['menu_items'] = $items;
}
}
-
Thanks a lot eCommerce Core and abolabo for the explanation and the added feature in v1.2.3. I will use the current solution then while waiting for the v1.2.3.