Overridden views components do not appear in the dropdown at /dmin/structure/features/features-override/add

If I flush the cache, then my overridden views appear as options in the dropdown, however when I submit the form, I get the following error, and the overridden view no longer appears in the dropdown.

An illegal choice has been detected. Please contact the site administrator.
Notice: Undefined index: views_view in features_override_ctools_export_ui_form_validate() (line 59 of /Users/tom/workspace/alumni/profiles/alumni/modules/contrib/features_override/plugins/export_ui/features_override_ctools_export_ui.inc).

Comments

nedjo’s picture

Thanks for the report. There have been a lot of changes in Views, Ctools, and Features since I wrote this. I'll have a look when I have a chance.

g76’s picture

sub

jessepinho’s picture

Version: 7.x-2.0-beta1 » 7.x-1.x-dev

I'm experiencing the exact issue described by mrfelton. Any updates on this problem? This would be my primary use for Features Overrides, as I want to create feature modules containing improvements on existing views.

jessepinho’s picture

Version: 7.x-1.x-dev » 7.x-2.0-beta1
Priority: Normal » Major

Updating version, as this is still a problem.

mpotter’s picture

Version: 7.x-1.x-dev » 7.x-2.0-beta1
Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

I need more of a step-by-step procedure for reproducing this. I created a View, added it to a feature. Then I changed the title of the view, then added this as an override in the FEATURE OVERRIDES (features_override_items) fieldset. This is all using the latest dev versions of Features 2.x and Features Override 2.x. So I'll need more info on exactly what changes you are making to the view that is causing the problem.

jessepinho’s picture

Status: Postponed (maintainer needs more info) » Active

mpotter: in my case, I'm overriding a view that is part of the Drupal Commerce suite. So, the view is not part of a feature; it's just implemented by a hook_views_default_views(). When I override that view via the Views UI, my overrides do not show up in Features Overrides (except for in the case of clearing the cache, which results in an error, as described above).

Let me know if I can explain anything more fully. Love the module!

gribnif’s picture

I also ran into this, and figured out the reason. Normally, the MODULENAME.views_default.inc file is loaded magically by views, therefore the hook it contains may not be properly registered in Drupal core. The diff code in Features Overrides depends on module_implements(), which fails in this case.

The workaround I used was to simply add this line near the top of my MODULENAME.module file:

require(dirname(__FILE__) . '/MODULENAME.views_default.inc');

I also added this file to the "file[]" list in the MODULENAME.info file, but I don't think this would help by itself, and is probably not required.

(Note: In all cases above, MODULENAME is the machine name of the feature being overridden, not that of the module containing the overrides.)

jessepinho’s picture

Nice find! That's got to be the reason for the problem.

The only problem with the solution, though, is that I don't want to modify contributed modules (like commerce_order_ui.module, for example, which has an includes/views/commerce_order_ui.views_default.inc file). Since a number of modules auto-load include files like this (Views and Rules come to mind), I'm thinking Features Overrides should modify its diff code, rather than requiring all contrib modules to modify the way they auto-load include files.

gribnif’s picture

I agree about not forcing everyone to modify their modules. I'm pretty sure there's a function in views to load the include (I don't recall the name offhand) which you can use before doing the hook check.

jessepinho’s picture

Looks like it's just views_include.

ShadowMonster’s picture

You do not need make changes in contrib modules. You can also include this files in your own MYMODULE.module - the problem is patch - if you work with drush you will get problem to include it correctly. Anyway there is work around for it ex.:

if($_SERVER['SCRIPT_FILENAME'] == '/usr/bin/drush') {
    $server_path = $_SERVER['HOME'] . '/public_html';
    }
else {
    $server_path = $_SERVER['DOCUMENT_ROOT'];
    }
    
require($server_path . '/sites/all/modules/commerce/modules/cart/includes/views/commerce_cart.views_default.inc');

I test it and is working but I have problem when try revert that feature wit store ex. cart form view - from features it not work at all - to can revert my view I have to use revert from View UI with seams work correctly.

Hope that help.

Found it thanks to E-Prepag.

pingwin4eg’s picture

Version: 7.x-2.0-beta1 » 7.x-2.x-dev
Issue summary: View changes

Any progress? Will this be fixed in Features Override?

mpotter’s picture

I don't see any patch here to be committed to Features Override. What I see is a case where Views is not loading it's modulename.views_default.inc file because a View has not been Featurized. Features Override is only intended to work with Features. So if a View is in custom code and not in a Feature then it's probably up to that custom code to ensure the proper files and hooks are handled.

In any case, I still don't see how Features Override can solve this.