0

I have created a module that adds a field to the user profile. When I disable the module, I want the field to no longer be shown on the user profile. I do not want to wipe it out completely, since I do that on uninstall. I want it to come back with the original data when the module is reenabled I just want to have it not display when the module is disabled. Is there a way to do this? I am using Drupal 7 and the field is a text field and it is set to the default formatter when I create the instance. Is there a setting I can set the instance to in hook_uninstall that will hide it?

1

I managed to accomplish it through code by setting the field instance:

    'display'       => array
      'default'     => array(
        'label'     => 'above',
        'type'      => 'hidden',
        'weight'    => '1',
        'settings'  => array(),
      ),
    ),
| improve this answer | |
0

You would probably need to do something with your theme in order to hide the filed. Obviously you can't use your module, as it is disabled. You could do a check with module_exists to see if the module is installed, and if it is, print the info, if not, ignore it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.