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.
Comment | File | Size | Author |
---|---|---|---|
#11 | d6-backport-1199590.patch | 520 bytes | David Hernández |
#7 | 1199590-export-doc-update-for-api.patch | 2.06 KB | merlinofchaos |
Comments
Comment #1
Torenware CreditAttribution: Torenware commentedHere'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:
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedLooks 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.
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedComment #4
Torenware CreditAttribution: Torenware commentedBe 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.
Comment #5
Torenware CreditAttribution: Torenware commentedEarl --
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?
Comment #6
Torenware CreditAttribution: Torenware commentedChanging 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.
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedWhy 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'. :)
Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedI'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.
Comment #9
DamienMcKennaThanks merlinofchaos.
Comment #11
David Hernández CreditAttribution: David Hernández commentedHi 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.
Comment #13
David Hernández CreditAttribution: David Hernández commented#11: d6-backport-1199590.patch queued for re-testing.
Comment #15
merlinofchaos CreditAttribution: merlinofchaos commentedtestboth has been asked to mind its own business for now.
Comment #19
DamienMcKennaFYI testbot doesn't work on D6, so the patches will obviously fail ;)
Comment #21
apaderno