Any idea why Features would be generating this:


/**
 * Implements hook_views_api().
 */
function ia_misc_views_api() {
  list($module, $api) = func_get_args();
  if ($module == "views" && $api == "views_default") {
    return array("version" => "3.0");
  }
}

when it should be generating this:

/**
 * Implementation of hook_views_api().
 */
function ia_misc_views_api() {
  return array(
    'api' => 3,
    'path' => drupal_get_path('module', 'ia_misc') . '/includes',
  );  
}

I'm running -dev of views 3, ctools and features under D7.

Comments

ezra-g’s picture

Category: support » bug

#1459120: Possible Views schema bug causes Features exports to fail has some more information about this from merlinofchaos. I believe this is actually a bug.

ezra-g’s picture

Title: hook_views_api changed? » Changes to hook_views_api cause Views plugins to be undefined
Status: Active » Needs review
StatusFileSize
new1.15 KB

The attached patch changes the way ctools_features_export_render() operates when defining hook_views_api().

Note, I first tried defining a separate features.views.inc, but that seems to be insufficient since ctools_features_export() will still run in general and call _ctools_features_get_info(), which reads from the {views_view} schema. It would appear as though we need to add an exception in one place or the other.

I tested this approach with drush fu on a feature that includes default views and a style plugin and both are re-exported correctly.

pol’s picture

Status: Needs review » Needs work

I think what you wrote is totally correct, however I have a few minor complaints:

+++ b/includes/features.ctools.incundefined
@@ -79,10 +79,17 @@ function ctools_features_export_render($module, $data) {
+        $code = array('  return array("version" => "3.0");');

I would do:
$code[] = ' return array("version" => "3.0");'

+++ b/includes/features.ctools.incundefined
@@ -79,10 +79,17 @@ function ctools_features_export_render($module, $data) {
+        $code[] = '  }';  ¶

Remove empty spaces at the end of the line.

+++ b/includes/features.ctools.incundefined
@@ -79,10 +79,17 @@ function ctools_features_export_render($module, $data) {
+      ¶

Remove empty tab.

ezra-g’s picture

Status: Needs work » Needs review
StatusFileSize
new1.29 KB

Thanks for the prompt review!

I moved

$code[] = '  list($module, $api) = func_get_args();';

to address your first point and fixed the spacing issues - Thanks for catching those. Just updated my editor and overwrote my default settings :P.

Thanks!

pol’s picture

For me it's good now :-)

tim.plunkett’s picture

StatusFileSize
new1.6 KB

Cross posting from #1480824: Unable to provide CTools plugins from a features module that provides a default view

If a feature has an exported panel page variant, it can no longer provide any other CTools plugin, like content_type. I think this whole thing should be gutted, not just Views.

mpotter’s picture

Status: Needs review » Reviewed & tested by the community

Tim's version looks the best for me and seems to work.

mpotter’s picture

Status: Reviewed & tested by the community » Fixed

Committed ef2f805

Status: Fixed » Closed (fixed)

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

mpotter’s picture

Here is the actual commit that was used instead for rc2: c6a1408

The commit in #8 broke features with views. It was reverted and this new patch was committed to rc2. Sorry for not posting this as a proper patch for people who wanted to use drush.make with it on rc1. But now you can just use rc2.

mpotter’s picture

Issue summary: View changes

forgot <?php.