The latest 7.x version of views has changed the way it deals with default views, which breaks the views-features integration.

Fatal error: Call to undefined function views_include_default_views() in [...]/features.module on line 332

Comments

mordonez’s picture

I'm getting the same issue

dawehner’s picture

Views in drupal7 uses ctools export, so the specific views integration could be perhaps dropped.

irakli’s picture

Assigned: Unassigned » irakli
Priority: Normal » Critical
lelizondo’s picture

Status: Needs work » Active

I just updated to Views/Ctools new devs versions and I'm getting a WSOD when trying to create a new Feature but I'm not getting this error.

aanjaneyam’s picture

subscribe

henrijs.seso’s picture

subscribe, same here

irakli’s picture

Status: Active » Postponed (maintainer needs more info)

Update: as expected, simply removing features.views.inc file (which used to implement non-CTools exporting) gets rid of the aforementioned error and Features starts relying on CTools for Views exporting; after which exporting views becomes possible in Features again.

However, enabling exported feature does not create view :( After much testing, I used CTools bulk export to export [the same, test-] view and code is seemingly identical (except for weirdly enough CTools Bulk export indicating API version as 2, while Features exports: 3.0 Will have to look into that), so I don't think Features is messing up much. Tried export/enabling a view with CTools Bulk Export and it did not work, either.

Anybody knows the status of CTools integration in Views? Is it still flaky in dev- or is it just me?

Will try to ping Views maintainers tomorrow if no response here.

Thanks

interx’s picture

Subscribe.

davidbarbarisi@gmail.com’s picture

I'm having the same issue. Commenting out the views_include_default_views(); line in features.module fixes it. It just won't export default views then, which is an acceptable workaround in my case.

irakli’s picture

@dbarbar, you should not comment that one line (that will just leave things broken) but remove the entire file.

davidbarbarisi@gmail.com’s picture

Thanks. I can confirm that exporting features using ctools for the view seems to work, but importing a feature in to a new site does not create the view.

MichaelCole’s picture

subscribe

zilverdistel’s picture

Thanx!

Removing the file features.views.inc fixed my problem ...

bojanz’s picture

irakli, what ctools version are you using?
Alpha3 had a bug that caused default views not to show up (#1097702: Export.inc needs to use version_compare()), it's fixed in the latest dev. It might be causing your problem.

aanjaneyam’s picture

@bojanz Well I am using Ctools DEV dated 19 March 2011 and I can only see custom views created by me.

irakli’s picture

@bojanz,

I am using both views and ctools from Git and have been pulling updates, but still looks broken.

Test-case:

1. Create a view
2. Export a view using CTools Bulk Export as a module
3. Delete view
4. Enable exported module

at which point the view should show up, but it does not (even through CTools, without any Features intervention).

Can anybody confirm that you are seeing the same, please?

Thanks

quartsize’s picture

Can anybody confirm that you are seeing the same, please?

I am seeing the same thing. EDIT: well, mostly the same thing. I wasn't using bulk export, but it looks like the problem is there, too.

See commits http://drupal.org/commitlog/commit/8124/eca98c081a59916d182cf6904eb88f23... and http://drupal.org/commitlog/commit/8124/ead17933e283764f7ef6308d34d74222....

merlinofchaos added hooks hook_$api_hook_name and hook_ctools_plugin_api_hook_name to CTools, allowing modules to specify a different name for hook_ctools_plugin_api. He also committed changes to Views to take advantage of the new hooks (see views_ctools_plugin_api_hook_name() in views.module).

In short: instead of generating code to implement hook_ctools_plugin_api, Features needs to generate code to implement hook_views_api, or whatever a module has decided to name its hook, for CTools integration to continue working.

quartsize’s picture

Priority: Critical » Major
Status: Fixed » Active

[EDIT: scratched]

bulk_export had the same problem Features has. merlinofchaos has now committed a fix for bulk_export, which needs to somehow be incorporated into Features.

quartsize’s picture

Downgrading to major because...

Scratch that; it is critical: it completely breaks drush fl, &c. if you don't remove includes/features.views.inc.

So it appears that includes/features.views.inc needs to be removed (or made conditional in some way), and includes/features.ctools.inc needs to be patched to accommodate the changes in CTools.

dasjo’s picture

Status: Postponed (maintainer needs more info) » Active

same issue here with todays dev versions of ctools, views and features

dasjo’s picture

after removing features.views.inc i still can't access my exported views like irakli stated in #7

also when accessing admin/structure/myfeature i receive

Notice: Undefined index: views in features_admin_components() (line 501 of /.../modules/features/features.admin.inc).
Notice: Undefined index: views in features_admin_components() (line 523 of /.../modules/features/features.admin.inc).
Notice: Undefined index: in theme_features_storage_link() (line 131 of /.../modules/features/theme/theme.inc).
Notice: Undefined index: in theme_features_storage_link() (line 138 of /.../modules/features/theme/theme.inc).
Notice: Undefined index: views_api in features_admin_components() (line 501 of /.../modules/features/features.admin.inc).
Notice: Undefined index: views_api in features_admin_components() (line 523 of /.../modules/features/features.admin.inc).
Notice: Undefined index: in theme_features_storage_link() (line 131 of /.../modules/features/theme/theme.inc).
Notice: Undefined index: in theme_features_storage_link() (line 138 of /.../modules/features/theme/theme.inc).

fangel’s picture

subscribe

scottkrieger’s picture

subscribe

bc’s picture

subscribing

irakli’s picture

Status: Active » Fixed

Committed: http://drupalcode.org/project/features.git/commit/922fce6

Had to commit to a separate branch though (7.views-post-alpha1-exportable-fix) since this change can not be released until new CTools/Views are released and just in case we need to release Features in the meantime. Will try to talk to CTools/Views guys to find out when that release is coming out so we can merge back.

Meanwhile, here's the diff: http://drupalcode.org/project/features.git/commitdiff/922fce6?hp=6f8cbb1...

Many thanks to whole bunch of people in IRC (including @quartsize and Earl but I apologize if I am forgetting somebody) - your help was instrumental and much appreciated in fixing this issue!

lelizondo’s picture

I love Git. Something like this would have been impossible to do with CVS. Thanks. :)

quartsize’s picture

@irakli: merlinofchaos seems to have rolled alpha4, so you can probably remove the copy of ctools_plugin_api_get_hook.

irakli’s picture

Merged the experimental branch back into 7.x-1.x Looks good to me.

Anybody available/willing to do some independent testing on 7.x-1.x, before we make a release?

Thanks

febbraro’s picture

Status: Fixed » Needs work

In the following code (line 85 of features.ctools.inc)

if (empty($plugin_api_hook_name)) { $api_hook = 'ctools_plugin_api'; }

Don't you mean to say

if (empty($plugin_api_hook_name)) { $plugin_api_hook_name = 'ctools_plugin_api'; }

It looks like you might have assigned 'ctools_plugin_api' to the wrong variable, $api_hook when you meant $plugin_api_hook_name?

quartsize’s picture

In the following code [...] Don't you mean to say [...]

That line shouldn't even be necessary, since ctools_plugin_api_get_hook (ctools/includes/plugins.inc:175) will not return empty.

irakli’s picture

Nothing gets past eagle-eye @febbraro :) Good catch!

Quartsize is correct, ctools_plugin_api_get_hook has similar check and never returns empty so removing the line.

Committed: http://drupalcode.org/project/features.git/commit/6ff1c7e

thanks

irakli’s picture

Status: Needs work » Fixed
molave’s picture

Hi all,

So...

Should I now download and apply the patch from this link from #31?
http://drupalcode.org/project/features.git/commit/6ff1c7e

I found this thread after a enabling Features 7.x-1.0-beta1 on a fresh D7 install and getting WSOD when trying to create a new Feature. The Manage Features page loads, though, without a problem.

Thanks

irakli’s picture

@molave,

if you are using latest Features and CTools, then your best bet is 7.x dev branch, which you can either checkout from Git or download as dev tarball.

molave’s picture

Ok got it---use the dev branch. Thanks irakli! That did not occur to me.

Cheers.

UPDATE:
Hey it worked! Very very cool. Thanks again to everyone.

pontus_nilsson’s picture

Can confirm that the -dev version did the trick

derEremit’s picture

when I import pre-views beta 3 features, everything is ok,
when I then export them the hook Implementation of hook_views_api(). is missing

without this my views won't get imported again.

views-3.x-beta3
ctools-1.x-alpha4
features-dev from 28 of March

i think the missing hook is inteded as I also get the message that i could remove empty module.features.inc
with the message:

// This file is deprecated and can be removed.
// Please remove include_once('" ".features.inc') in " ".module as well.

SofiaSund’s picture

Hi
After upgrading to features-7.x-1.x-dev, I get the same error messages as dasjo #21 (using the latest stable version of Views (7.x-3.0-beta3) and CTools (7.x-1.0-alpha4). I tried upgrading to the latest Views dev version (7.x-3.x-dev) and to the latest CTools dev version (7.x-1.x-dev), but the error is still there.

Since some of you (molave and pontus_nilsson) seem to have got everything working, am I missing something?

pontus_nilsson’s picture

Correction from #36. I am able to export with -dev of features but when reverting the feature all my views in the feature are bye bye.

molave’s picture

Priority: Major » Critical
Status: Active » Fixed

Thanks for the update pontus_nilsson.

Hi SofiaSund. I'd like to expand on #35: after the WSOD scare, I was able to get Features to run upon switching to the 7.x-1.x-dev branch. I have been able to create a "backup" module for my D7 site using Features...

However, I have not yet had a chance to restore that module on another D7 installation. That part will have to wait until I finish building all my content types. I might be on the same boat as pontus. Will report back as soon as I know more.

setvik’s picture

I have a feature created with alpha version of views and previous version of features and ctools.

Upgraded to the latest Views, CTools, and Features (dev), I still get the bug described in the OP when running drush feature-update [featurename].

Attached patch got rid of the error and allows me to update my existing feature.

dasjo’s picture

Status: Fixed » Needs review

just wanted to note, that i solved some strange (like #21) errors by moving from the outdated ctools master branch to the current 7.x-1.x branch

dasjo’s picture

Status: Needs review » Fixed
robertom’s picture

Status: Fixed » Needs work

Same problem of #39...
I am able to export with -dev of features from my dev server, but when I import features on staging server all my views in the feature are gone (not appear on admin/structure/views). I have to import it manually.

olafveerman’s picture

subscribe

irakli’s picture

Status: Needs work » Fixed

I think update path is a separate issue, and since dasjo has already created an issue about it: http://drupal.org/node/1113060, I don't think it should be discussed here.

robertom’s picture

I think update path is a separate issue, and since dasjo has already created an issue about it: #1113060: Fix upgrade path for recent views integration changes, I don't think it should be discussed here.

You are correct. I have misunderstood the scope of the separate issue.

Sorry for noise

Status: Fixed » Closed (fixed)

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

googletorp’s picture

Status: Closed (fixed) » Needs review

The original problem still seems to be an issue:

Error: Call to undefined function views_include_default_views() in /modules/contrib/features/features.module,
err: line 333

Looking at an earlier version of Views, this commit should fix the issue: commit on sandbox

Or you can take a look at the diff

idflood’s picture

Solution proposed in #49 seems to be working. After applying the patch the page load with some warnings but this may not be related to this specific issue.

zarudnyi’s picture

Solution in #49 works for me. Thank You.

dasjo’s picture

there is some strange behaviour of default/overridden states of view features.

  1. "drush fd" lists all features that contain a views as overridden, but in fact they aren't
  2. "drush fd myviewfeature" indicates that the feature was empty before and it will add the whole view export to it.
  3. "drush fu myviewfeature" updates the feature as expected, but of course the file contents don't change
  4. "drush fd" lists all features in default state now
  5. executing "frush fd" one more time means starting at 1. again...
nedjo’s picture

Patch for the diff in #49 attached. Also attaching -p0 version, since this is likely to be needed in drush make files.

This fix is needed because views_include_default_views() was removed from views.

Bevan’s picture

dasjo; I have also been experiencing this, but I think it is a different bug, possibly related to very recent versions of views-7.x-3.x. I have moved this to #1157048: Feature-packages appear overridden when they are not.

Anonymous’s picture

drush make patch in #53 works for me

febbraro’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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