If the site has not librariy Mobile Detect, then the module shows a white screen. Also, if the module Navbar is broken (deleted), the mobile device has no any admin menu: no Navbar, no Administration menu.
To test the module in the script proposed to add to the file admin_menu_navbar/admin_menu_navbar.module to the function: function admin_menu_navbar_page_build(&$page) () at the very beginning:
/*check if modules do not exist*/
if (!module_exists('admin_menu') || !module_exists('navbar') || !module_exists('mobile_detect')) return;
To check the library ** Mobile Detect ** available in the module code further in the file admin_menu_navbar / admin_menu_navbar.module add:
/*check if Mobile Detect library not work and class not exists return*/
if (!class_exists('Mobile_Detect')) return;
We have added a silent check this way. If something is not installed and running, the module will stop working, then you will see either only one menu, or both, if both menu modules are activated.
Remain Task:
- We need to display an error and log it if one of the module does not exist.
- We need to check on a hook_install if the those libraries are available.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | admin_menu_navbar-check_dependencies-2531724-4-D7.patch | 1.33 KB | milodesc |
| #2 | 2531724-Refine-module-Admin-Menu-Navbar-with-simple-.patch | 990 bytes | darol100 |
Comments
Comment #1
tlito commentedComment #2
darol100 commented@tlito, great approach but I think we should also add a error message saying that one of the libraries is been missing. In addition, we should add those checks into the hook_install to make sure that we do not install the module without those libraries.
I have attached a patch with @tlito suggestions. But we should implement an error log and error display for login users if those libraries are not available.
Added the Novice tag because I think simple task for someone that is looking to contribute.
Comment #3
milodescComment #4
milodescI took a shot at the error message/error log task from this issue.
I thought about implementing the check for the Mobile Detect library upon install of the Admin Menu Navbar, but isn't that already handled in the Mobile Detect module's mobile_detect_requirements function? Are we worried that the library gets uninstalled after installing the Mobile Detect module and before installing the Admin Menu Navbar module? If so, maybe we should duplicate the Mobile Detect module's mobile_detect_requirements functionality in admin_menu_navbar.install?
Comment #5
milodescComment #6
leopaccanaro commentedComment #8
darol100 commented#4 There is not need to re-implement the mobile_detect_requirements again in this project. Thank you for all this work. I have push this to the dev version of this project.
=)
Comment #10
izmeez commentedI know this was committed a long time ago and it looks like an important check so I wonder if it would be a good idea to put out a new 7.x-1.1 release?