There wasn't an option for Features Integration in the components list, so I added this to flag core.

In any case, when exporting a flag with Features, the output is not properly indented since the export function relies directly on var_export. The attached patch corrects that by adding an indent parameter to the export function (which defaults to the empty string) and using the ctools_var_export function if it is available. I did not want to (as I imagine you don't want to) make CTools a hard dependency just for this one thing, but I also really didn't want to have to recreate the functionality. I assume that most people using features already have CTools installed. In any case, it does preserve the existing format for all existing cases (that don't use Features) since the indentation will be empty in all export cases *except* where Features is being used to export the flags.

Comments

mooffie’s picture

Version: 6.x-2.0-beta3 » 6.x-2.x-dev
Category: bug » task
StatusFileSize
new1.88 KB

Here's the same patch with two changes:

- I changed it to use features_var_export() instead of ctools_var_export(). It's probably more likely to exist.
- I added module_load_include('inc', 'features', 'features.export') so that the function can be utilized even on our admin/build/flags/export page.

mooffie’s picture

Status: Needs review » Fixed

Committed.
http://drupal.org/cvs?commit=469574
http://drupal.org/cvs?commit=469576

(If you want to provide a patch that goes back to ctools_var_export() that's fine with me. But it won't hurt to call ctools_include() to load it.)

amitaibu’s picture

> ctools_var_export() that's fine with me

Is flag going to be dependent on CTools?

mooffie’s picture

Is flag going to be dependent on CTools?

No, we're just using its (Features', actually) utility function if, and only if, it exists, because it has an $indent parameter that PHP's var_export() hasn't.

(But it's not that I'm against, or not see the value in, good key modules. Plugins/callbacks/prototypes are more powerful than PHP's horrific OO capabilities.)

mgriego’s picture

Yeah, I had forgotten about features_var_export(). Makes a lot more sense to use that. :)

Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -features

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