In D7, there is a feature allowing modules to be hidden from admin pages, which means that if a module is disabled and then hidden, there is no easy way to enable it via admin UI.

I have a situation where in there are some features that i would like them to live in the codebase in a disabled state, I also manually set the hidden = true in .info file so that the features are not displayed for site admin page.

However the features page still displays them in features list and also shows them as conflicts.
There should be a way to say features "x/y/z" can live in the code base but shall not be displayed in UI and not considered when looking for conflicts.

Comments

Ravi.J’s picture

On closer look, it does hide the feature from displaying on the Features admin form, however does not consider the hidden + disabled settings when checking for conflicts.

Ravi.J’s picture

Patch attached

rickvug’s picture

Status: Active » Needs work

With the patch applied I get the following errors on install:

Warning: array_filter() expects parameter 2 to be a valid callback, function 'features_filter_hidden' not found or invalid function name in features_get_info() (line 488 of docroot/profiles/my_profile/modules/contrib/features/features.module).
Warning: Invalid argument supplied for foreach() in features_get_info() (line 489 of docroot/profiles/my_profile/modules/contrib/features/features.module).
Warning: array_filter() expects parameter 2 to be a valid callback, function 'features_filter_hidden' not found or invalid function name in features_get_info() (line 488 of docroot/profiles/my_profile/modules/contrib/features/features.module).
Warning: Invalid argument supplied for foreach() in features_get_info() (line 489 of docroot/profiles/my_profile/modules/contrib/features/features.module).
Ravi.J’s picture

Revised patch, missed out on include features.admin.inc

rickvug’s picture

Thanks @Ravi.J. The updated patch works as advertised. What may be needed however is a check to see if the hidden module has already been enabled. Beyond this I don't see any problem.

rickvug’s picture

Title: Hidden and disabled features should be displayed in UI and should not be considered for Conflicts » Hidden and disabled features should not be displayed in UI and should not be considered for conflicts
febbraro’s picture

Assigned: Unassigned » febbraro
rickvug’s picture

Status: Needs work » Needs review
StatusFileSize
new721 bytes

Attached is the patch re-rolled against dev.

febbraro’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

smokris’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Assigned: febbraro » Unassigned
Status: Closed (fixed) » Needs review
StatusFileSize
new603 bytes

This is also a problem in features-6.x-1.x.

Patch attached, which hides modules from admin/build/features when the module's .info file has hidden=TRUE.

hefox’s picture

Status: Needs review » Needs work

Note for those who didn't know hidden was in 6.x: it was added about a year ago as a backport due to simpletests.

Small coding standards issues

White space issues (line before the foreach has two extra spaces) and spacing of control structure

  if (!empty($feature->info['hidden'])) {
    unset($features[$key]);
  }

(Well the isset vs not empty isn't coding standards, but equivalent and a bit shorter)

(thanks for the patch, etc., smokris)

smokris’s picture

Status: Needs work » Needs review
StatusFileSize
new576 bytes

Good point — I replaced the isset() with empty(). New patch attached.

Not sure what you're talking about regarding there being extra whitespace — I don't see two extra spaces in line before either foreach in my previous patch. Going through the checklist on http://drupal.org/coding-standards#indenting: I'm using 2 spaces to indent, I don't have any trailing whitespace, I'm using \n.

http://drupal.org/coding-standards#controlstruct says that using frivolous curly braces is "strongly encouraged", but not required. I chose not to use frivolous curly braces, because in my opinion they decrease readability in very simple cases like this (and would add two extra lines to a three-line patch). I don't see any conflicts with the coding standards for control structures.

hefox’s picture

Status: Needs review » Needs work

Was browsing the patch too fast; you're right on there being no extra space, sorry for the confusion!

The coding standards have suddenly changed from "strongly encouraged" to "always", so switch em (for the if and foreach)? Pretty please with a cherry on top!

Once that's done, one passing review and this should be RTBC

smokris’s picture

Status: Needs work » Needs review
StatusFileSize
new592 bytes

Wow. "Suddenly changed," eh? Quite a coincidence.

I've attached the patch again, now with curly braces.

mpotter’s picture

I am reverting this patch in the 7.x-1.x branch because it prevents a hidden Test feature from working (tests fail). After removing this patch I still do not see hidden features in the UI and do not see them in the conflicts. Maybe this is related to the changes in the 1.1 UI. If people discover that there is still a case where a hidden and disabled feature still shows as conflicts, please let me know.

It's possible the D6 patch is still useful, but not for D7.

damienmckenna’s picture

StatusFileSize
new592 bytes

This is 100% identical to #15 only has the correct filename to trigger the testbot.

damienmckenna’s picture

Status: Needs review » Reviewed & tested by the community

RTBC, forgot that testbot doesn't work on D6.

hefox’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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