I'm trying to create a feature via Features 7.x-1.0-beta3 that exports a Stylizer style. This consistently fails with multiple "missing index" errors, and the archive generated in features contains files with malformed names (hook_default_stylizer() is put in a file called FEATURE_NAME..inc), and at least one file which is not valid PHP (in this case, FEATURE_NAME.features.inc. The .info file also looks weird:

core = "7.x"
dependencies[] = "stylizer"
description = "Demonstrate export bug"
features[ctools][] = "stylizer::"
features[stylizer][] = "tfc_fp_style"
name = "Stylizer Test"
package = "Features"
project = "stylizer_test"
version = "7.x-1.0-beta1"

I'm not sure where to file this issue. The problem I'm having is very specific to Stylizer, and looking at some of the data structures in the debugger, I'm guessing that the 'export' section in stylizer.install is probably not updated for the current version of the export API:

    'export' => array(
      'bulk export' => TRUE,
      'export callback' => 'stylizer_style_export',
      'can disable' => TRUE,
      'identifier' => 'style',
      'primary key' => 'sid',
    ),

BTW: are there docs for the export API in the current ctools? I can't find any, which is making it harder for me to figure out where the problem is occurring.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Torenware’s picture

Here's a list of error generated. Again, since this is on the border between CTools and Features, it's hard to tell where I need to check:

  • Notice: Undefined index: api in ctools_features_export() (line 56 of /home/rtoren/Torenware/Website/tfc-student-info/docs/sites/all/modules/features/includes/features.ctools.inc).
  • Notice: Undefined index: current_version in ctools_features_export() (line 56 of /home/rtoren/Torenware/Website/tfc-student-info/docs/sites/all/modules/features/includes/features.ctools.inc).
  • Notice: Undefined index: api in _ctools_features_get_info() (line 256 of /home/rtoren/Torenware/Website/tfc-student-info/docs/sites/all/modules/features/includes/features.ctools.inc).
  • Notice: Undefined index: current_version in _ctools_features_get_info() (line 256 of /home/rtoren/Torenware/Website/tfc-student-info/docs/sites/all/modules/features/includes/features.ctools.inc).
  • Notice: Undefined index: api in ctools_features_export_render() (line 79 of /home/rtoren/Torenware/Website/tfc-student-info/docs/sites/all/modules/features/includes/features.ctools.inc).
  • Notice: Undefined index: current_version in ctools_features_export_render() (line 80 of /home/rtoren/Torenware/Website/tfc-student-info/docs/sites/all/modules/features/includes/features.ctools.inc).
  • Notice: Undefined index: api in ctools_features_export_render() (line 84 of /home/rtoren/Torenware/Website/tfc-student-info/docs/sites/all/modules/features/includes/features.ctools.inc).
  • Notice: Undefined index: default_filename in features_export_render() (line 196 of /home/rtoren/Torenware/Website/tfc-student-info/docs/sites/all/modules/features/features.export.inc).
merlinofchaos’s picture

Looks like features is assuming the 'api' key is required when it's optional, and that is messing up its ability to export stylizer styles properly. That's probably a features bug.

merlinofchaos’s picture

Status: Active » Closed (won't fix)
Torenware’s picture

Be things as they way, the patch at http://drupal.org/node/1155310#comment-4461808 appears to resolve this issue.

My 2¢ here: while 'api' may not be a required key from the perspective of ctools generally, it sounds like in this case it needs to be required for Features and CTools to work well together. This bug has been bouncing around for a while (I see versions of it up to a year old), so it would be good either if Earl or one of the other committers on CTools suggest to the Features people how best to handle the case where the key is absent, or the features people need to say that in order to support features, the bare CTools specification does not suffice, and simply say that modules like Stylizer are non-compliant.

My sense looking through this is that this is a difficult issue for even most developers to fix, and it affects the perceived usability of both CTools and Features. So if possible, the two communities need to talk to each other to resolve this.

Torenware’s picture

Earl --

To a fair extent, this is at least a documentation issue at your end: the correct behavior of a plug-in client in this case doesn't appear to be defined, and absent a definition in the CTools documentation, the Features people made an assumption that was incorrect.

I'm having trouble finding good docs for big chunks of CTools and and Panels 3, so I'm sympathetic to the Features people's problem.

If the api key is missing, what should a plug-in client assume?

Torenware’s picture

Category: bug » support
Status: Closed (won't fix) » Needs review

Changing category and status, since while this may not strictly be a CTools issue, resolving it is likely to require help from one of the CTools committers.

merlinofchaos’s picture

Why is this 'needs review'? There is no patch. This should be 'active'.

If there is no 'api' key, then features should assume that there are no api restrictions and that there won't be a file to put the hook_* in. See ctools_export_to_hook_code() to see how CTools' export does it.

Now, I may just add the api key to stylizer anyway and create a default_styles.inc because it's friendly. That does not change the fact that features is assuming it should be there.

Also, running into API issues after the fact and blaming me rather than asking questions during the fact doesn't really help anyone. I've always been pretty responsive to questions when people want to use the APIs, and that's how the documentation gets written and/or improved. Unfortunately, a lot of features stuff got written, and when confronted with problems, instead of asking me, things just happened around. It's hard for me to know about things I need to deal with when this happens.

This is also why some API changes got made that affected features; I hadn't realized what they were doing.

Here's a documentation update for the api keyword in export.html

The export.inc documentation is actually pretty decent, though it doesn't cover the 'api' part very well; it's actually only included as an example. So that can be improved.

Here's a patch to try and improve that documentation. Now it can be 'needs review'. :)

merlinofchaos’s picture

Status: Needs review » Fixed

I've gone ahead and added an "api" section for stylizer, just becauses the styles should be allowed to live in a separate file. It's cleaner that way. I also accidentally committed the doc update with another patch, so it'll just have to do.

DamienMcKenna’s picture

Thanks merlinofchaos.

Status: Fixed » Closed (fixed)

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

David Hernández’s picture

Status: Needs work » Needs review
Issue tags: +Stylizer, +features support in ctools
FileSize
520 bytes

Hi there,

If anyone needs it, I did a backport for D6 of the required change. After the patch is applied, you will need to clear the Drupal's cache.

Regards,
David.

Version: 7.x-1.0-beta1 » 6.x-1.x-dev
Status: Closed (fixed) » Needs work
Issue tags: -Stylizer, -features support in ctools

The last submitted patch, d6-backport-1199590.patch, failed testing.

David Hernández’s picture

Issue tags: -Stylizer, -features support in ctools

#11: d6-backport-1199590.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Stylizer, +features support in ctools

The last submitted patch, d6-backport-1199590.patch, failed testing.

merlinofchaos’s picture

Status: Needs work » Needs review

testboth has been asked to mind its own business for now.

The last submitted patch, 7: 1199590-export-doc-update-for-api.patch, failed testing.

DamienMcKenna’s picture

Issue summary: View changes

FYI testbot doesn't work on D6, so the patches will obviously fail ;)

apaderno’s picture

Issue tags: -Stylizer, -features support in ctools