Modules like boxes allow their content to be exported. It is then stored as a multiple line variable eg.:
/**
* Helper to implementation of hook_default_box().
*/
function _test_feature_default_box() {
$export = array();
$box = new stdClass;
$box->disabled = FALSE; /* Edit this to true to make a default box disabled initially */
$box->api_version = 1;
$box->delta = 'boxy';
$box->title = 'boxy';
$box->description = 'test box';
$box->body = 'line 1
line 2
line 3';
$box->format = 1;
$export['boxy'] = $box;
return $export;
}
When one installs this as a feature for instance the box data is still fine. But when it is being rerolled ctools will re-export these variables, adding indentation to the lines again so this above will become:
**
* Helper to implementation of hook_default_box().
*/
function _test_feature_default_box() {
$export = array();
$box = new stdClass;
$box->disabled = FALSE; /* Edit this to true to make a default box disabled initially */
$box->api_version = 1;
$box->delta = 'boxy';
$box->title = 'boxy';
$box->description = 'test box';
$box->body = 'line 1
line 2
line 3';
$box->format = 1;
$export['boxy'] = $box;
return $export;
}
And so on on each consecutive feature roll, effectively changing the content. This is caused by adding the indentation prefix in ctools_var_export
. I think it could be solved by simply adding a string flag to the export code, so multiple lines will not be prefixed with the indentation.
Comment | File | Size | Author |
---|---|---|---|
#1 | ctools_multiline_indent.patch | 943 bytes | snufkin |
Comments
Comment #1
snufkin CreditAttribution: snufkin commentedComment #2
mgriego CreditAttribution: mgriego commentedSee: http://drupal.org/node/758750 which has a different patch for this same problem. The patch attached here can still result in indentation for scalars embedded in arrays.
Comment #3
snufkin CreditAttribution: snufkin commentedYepp, i'll mark it as duplicate.