Islandora/islandora_content_model_forms — pull request #46 by ksclarke (2012-10-17 18:50:39+00:00)
Title: fixed _disable hook so module could be disabled

I'm a complete Drupal/Islandora newbie so less than sure of this pull request, but I'll explain the problem and my solution.

After installing the recently changed islandora_content_model_forms module, I was not able to disable the module. The error I was getting (when trying to disable from the admin/modules page) was:

Warning: Missing argument 1 for islandora_content_model_forms_disable() in islandora_content_model_forms_disable() (line 305 of /var/www/html/drupal-7.15/sites/all/modules/islandora_forms/islandora_content_model_forms/islandora_content_model_forms.module).
Warning: Missing argument 2 for islandora_content_model_forms_disable() in islandora_content_model_forms_disable() (line 305 of /var/www/html/drupal-7.15/sites/all/modules/islandora_forms/islandora_content_model_forms/islandora_content_model_forms.module).
Notice: Undefined variable: id in islandora_content_model_forms_disable() (line 307 of /var/www/html/drupal-7.15/sites/all/modules/islandora_forms/islandora_content_model_forms/islandora_content_model_forms.module).
Specified association does not exist.

The hook was working when being called from the admin/islandora/model/forms page, though, so what I did was to initialize the incoming parameters (since they didn't seem to be supplied when trying to disable the module itself) and check to see whether they were initialized before running the code in the hook. If they are initialized, the content is coming from the admin/islandora/model/forms page and is run, but if they aren't initialized the call is coming from the module disable action and the associations are just left in place (the code isn't run). I think they'd only be removed in the case of you uninstalling the module(?) not just disabling it(?)

Anyway, there might be a better way of solving this for someone who is more familiar with the system, but this was my solution.