- πΊπΈUnited States hummeldon
Our team has had this module sitting unused and unable to uninstall for the same reasons. I finally wanted to take a stab and fixing the issue.
Problem
Uninstalling Mobile Device Detection will delete blocks that have the module listed as a dependency.
Solution
Added code to the
mobile_device_detection_uninstall()
hook to iterate through all config files with theblock.block
prefix:- Removes instances of 'mobile_device_detection' under dependencies.module
- Removes instances of 'mobile_device_detection' under visibility
Notes
Drupal will warn you of blocks that will be deleted on uninstall. I believe this is because Drupal detects the dependencies prior to the uninstall hook resolving the dependency issues. In my testing with this patch, these are false alarms.
To aid users with identifying affected blocks, I've included a log notice upon uninstall that mentions any blocks that were modified.
This patch is not intended to included in a release of this module. It is simply to assist others with uninstalling this unmaintained and problematic module. My suggestion would be that this module be fully retired and point users to Mobile Detect β
Finally, I want to stress that you should absolutely test this in a dev environment before attempting to use it on a production environment. Regardless of my experience with the patch, there is still a risk that blocks will be deleted and you should be certain it works in your environment beforehand.
Also, this is my first ever contribution to the Drupal community! I hope this helps people out.