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.

Comments

tlito’s picture

Title: Refine module Admin Menu Navbar with simple check if the modules and libraries exixt » Refine module Admin Menu Navbar with simple check if the modules and libraries exist
darol100’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Issue summary: View changes
Status: Patch (to be ported) » Needs work
Issue tags: +Novice
StatusFileSize
new990 bytes

@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.

milodesc’s picture

Assigned: Unassigned » milodesc
milodesc’s picture

Status: Needs work » Needs review
StatusFileSize
new1.33 KB

I 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?

milodesc’s picture

Assigned: milodesc » Unassigned
leopaccanaro’s picture

Status: Needs review » Reviewed & tested by the community

  • darol100 committed 7fc6673 on 7.x-1.x authored by milodesc
    Issue #2531724 by milodesc, darol100, tlito: Refine module Admin Menu...
darol100’s picture

Status: Reviewed & tested by the community » Fixed

#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.

=)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

izmeez’s picture

I 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?