features_banish provides a way to exclude component items like specific strongarm variables, views, etc, from being exported, or even showing up as options in the UI for export. This functionality might make sense to have in core features instead of just in contrib. This ticket is to start that conversation and get feedback on that.

Why would it make sense to be in core features?

Example 1 : Contrib modules provide their own banishment defaults

A contrib module provides values that don't ever make sense to export, it could declare these variables in it's module.info file, and then they wouldn't show up in features ui. And example might be twitter module using a variable for the last time it checked the twitter api.. we'll call it "twitter_last". Without havin gany hard dependency on features, the twitter module maintainers might add the following to the twitter.info file:

features_banish[variable][] = twitter_last

Now if anyone using features core (with banish built in) goes to export their other twitter settings, like the account name, then they won't ever even see "twitter_last" come up in the UI, and developers won't mistakenly export that variable.

Example 2 : Devs can banish additional settings as well

To continue the twitter module example, say a developer using twitter module wants to export the twitter username, but not the password. They are using the database, or perhaps a mixture of $_ENV and $conf variables to keep the password from living in the actual codebase. In their custom features module called mytwitter that exports the twitter settings they can add the following line to mytwitter.info

features_banish[variable][] = twitter_password

Now, other developers working on that module will no longer accidentally export that value into the mytwitter module (or any other features module they create).

Example 3 : Banish a default view provided by a contrib module, but isn't used.

Some module provides a default view that isn't used, but shows up in the features UI as an option. Using the same technique as Ex 2, we can exclude it from showing up in the features UI.

Example 4 : A features exported view is provided by a contrib module, but isn't used or wanted in any UI ( Views UI or features UI) .

In this case, we'd like to pretend that the contrib module hadn't shipped with that view in the first place. I'm not sure how this would work in features_banish right now. I think it would actually remove it, but then the contrib module might be shown as overridden... maybe we could make it smarter so that the features_render is altered as well and it's actually like the view was never exported.

Thoughts, concerns and feedback welcome :)

Comments

frankcarey’s picture

Issue summary: View changes
lpalgarvio’s picture

i love this idea!

mpotter’s picture

There is already a features_exclude option that should mostly do this. If you uncheck one of those "automatically auto-detected components" then it won't get exported and it will be marked in the info file with a features_exclude option that prevents it from being auto-detected in the future. So it won't get added unless somebody explicitly selects it, which they should be allowed to do imho.

I don't think I want to actually hide something from the UI. That's up to the person doing the export to decide what they want to export.

frankcarey’s picture

@mpotter - /* aside */ It was good to see you at NYCCamp last weekend, really appreciated the great Features in D8 presentation :)

Yes, this is sort of like exclude, but on steroids. "features_exclude" is also an info file flag, and it also prevents export, but ONLY for the module in which that setting is made.. in other words only locally.

features_banish is more opinionated as it prevents export from ANY other module, AND hides the variable from the UI, reducing clutter (it does add an area in the features setting tab so that you can see what's been banished globally).

nbchip’s picture

Duplicate

nbchip’s picture

This is a great idea. @frankcarey All good examples, especially Example 1.
By using Features in combination with defaultconfig and features_banish it is possible to create StarterKit install profile that has everything in code. So that after fresh site install, you would have zero components to add to new feature until you create some configuration. UI would be much cleaner and it would immediately be clear what you changed and not cluttered with things which you would never want to export like cron_last.
This would also allow more experienced developers to prevent less experienced developers from exporting unnecessarily things.