available at admin/structure/features/lock, or maybe admin/structure/features/[feature_name]/lock

ui to select from components/items exported to given feature and "lock" them from being reverted/rebuilt on a given site, even manually (via _features_restore()).

Probably can only do it at a component level (e.g. "for feature x, do not revert/rebuild: field bases, user permissions"), and not an item level (e.g. for feature x, do not revert/rebuild user permissions y).

Motivation: less need for default content, by allowing anything the user wants to change to be locked but still able to run such things like fra .

However, this is NOT to replace features override (e.g. this is not to allowing people to disable reverting user permission Y then exporting it to a different feature and having both original and new enabled), though that does present an interesting idea.

#6 2047253-features-lock-??.patch11.99 KBhefox
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es).
[ View ]
#4 2047253-features-lockunlock-3.patch10.97 KBhefox
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es).
[ View ]
#2 2047253-features-lockunlock-2.patch11.01 KBhefox
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es).
[ View ]
#2 Screen shot 2013-10-21 at 4.01.27 PM.png111.43 KBhefox


Hmm, I really like this idea. Would help prevent changes made on a site (like different config on production) from being overwritten by a re-build that does a feature-revert-all.

Rather than adding to the Recreate screen, perhaps a UI can be added to the feature list screen where each included component could have it's own checkbox for lock/unlock and have some sort of obvious color/style change to show which are locked? Not sure we need a whole new menu hook/page since the current View page already has all the needed information.

new111.43 KB
new11.01 KB
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es).
[ View ]

Branch 7.x-2.x-2047253

Defiantly needs some more work, code comments, function names, link titles, explanation, etc. but looks to be working so far.

Can see current ui in screenshot; just added it to the overview page. I figure replace the links with glp complaint padlock graphics.

Status:Active» Needs review

new10.97 KB
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es).
[ View ]

I sorta want it to say "I'm sorry Dave, I'm afraid I can't do that" when someone fr a locked thing

Overall, this looks pretty solid. I haven't really reviewed it for specific UI design.


As a matter of basic approach, this is providing UI and using variable storage. This means we are putting locking in the hands of a site administrator. This is a bit different slant than focusing on building features as a developer or site builder where some or all elements are locked by default.

The way this is built, site owners have the power to decide which upstream configuration changes to override and ignore. In the alternate way I mention, distribution creators would control which features/components are enforced and which are default.

Practical difference would be cooking the locking into the construction of the features/info file vs. the administration of the feature/variables.

I think both constituencies are valid, just want to make sure we know who we are empowering.

Code & String Review

  1. +++ b/features.admin.inc
    @@ -1367,6 +1371,66 @@ function features_feature_diff($feature, $component = NULL) {

    Extra space

  2. +++ b/features.admin.inc
    @@ -1367,6 +1371,66 @@ function features_feature_diff($feature, $component = NULL) {
    + *   A loaded feature object to display differences for.

    Not sure exactly what differences this is talking about. How about: "Loaded feature object to be processed for component locking."

  3. +++ b/features.admin.inc
    @@ -1367,6 +1371,66 @@ function features_feature_diff($feature, $component = NULL) {
    + *   (optional) Specific component to lock for

    A specific component to lock.

  4. +++ b/features.admin.inc
    @@ -1367,6 +1371,66 @@ function features_feature_diff($feature, $component = NULL) {
    +function features_feature_lock_form($form, $form_state, $feature, $component) {


  5. +++ b/features.admin.inc
    @@ -1367,6 +1371,66 @@ function features_feature_diff($feature, $component = NULL) {
    +  $question = $is_locked ? t('Are you sure you want to unlock this Feature @name (component @component).', array('@name' => $feature->name, '@component' => $component ? $component : t('none'))): t('Are you sure you want to lock this component?');

    1. Unlock/Lock confirmation message symmetry. Unlock names the feature and component, lock just says "this component".

    Also, way longer than 80 chars. Can we multiline this?

  6. +++ b/features.admin.inc
    @@ -1367,6 +1371,66 @@ function features_feature_diff($feature, $component = NULL) {
    + * Locks a feature.

    "Submit callback to lock components of a feature."

  7. +++ b/features.admin.inc
    @@ -1367,6 +1371,66 @@ function features_feature_diff($feature, $component = NULL) {
    +    drupal_set_message(t('Feature @name (component @component) has been unlocked.', array('@name' => $feature, '@component' => $component ? $component : t('none'))));

    What would it mean to say "Feature Awesome Blog (component none) has been unlocked"?

    Also, it might be clearer to read things that could be multiple words to wrap them in single quotes.

  8. +++ b/features.drush.inc
    @@ -725,8 +725,13 @@ function drush_features_revert() {
    +                drush_log(dt('Skipping locked @module.@component.', $dt_args), 'ok');

    I think this should be 'notice' or 'info'. It represents no change, therefore it's probably only of interest in verbose mode.

  9. +++ b/features.module
    @@ -167,6 +167,17 @@ function features_menu() {
    +    'description' => 'Lock a feature or components.',

    I can't think of a better description, but I think somewhere in the module README or admin page we need something to explain what locking means in greater detail.

  10. +++ b/features.module
    @@ -1109,3 +1137,46 @@ function features_get_deprecated($components = array()) {
    +function features_feature_locked($feature, $component = NULL) {

    Difference between features_feature_locked and features_feature_lock is too subtle.

    features_feature_is_locked and features_feature_lock?

Issue summary:View changes
new11.99 KB
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es).
[ View ]

Patch done while d.o was down, adding icons to links (not updated for stuff mention above)

Seems that commit a338503 is a slightly modified version of the patch in #4?

Yep, and that commit is to branch 7.x-2.x-2047253

Should update that branch for #6; I believe pushing was down when I was working on that patch. And I forgot I'd made a branch for this issue