When exporting a preset, the $items array is storing $openlayers_map_presets, while the actual presets are stored in $openlayers_presets (see export code below).
This means that presets exported to code do not show up at admin/build/openlayers/presets
The reason for this is that the $api for the object export in openlayers_ui.module (line 512) is 'openlayers_map_presets', whereas the ctools_export_object() function in ctools/includes/export.inc line 383 is using $identifier, which comes from the $schema['export']['identifier'] which is set in openlayers.install line 46 as 'openlayers_presets'.
I'm not sure what else the identifier in the $schema is used for, so I'm not sure if this is the correct value to change. If anyone can point me in the right direction I'll fix and create a patch tomorrow.
Below is the output of exporting a preset.
$items = array();
$openlayers_presets = new stdClass;
$openlayers_presets->disabled = FALSE; /* Edit this to true to make a default openlayers_presets disabled initially */
$openlayers_presets->api_version = 1;
$openlayers_presets->name = 'neighborhoods_display';
$openlayers_presets->title = 'Display Neighborhoods';
$openlayers_presets->description = 'Display neighborhood polygons in a view';
$openlayers_presets->data = array(
'width' => 'auto',
'height' => '400px',
'image_path' => '',
'css_path' => '',
'proxy_host' => '',
'center' => array(
'initial' => array(
'centerpoint' => '-73.969230648906, 40.756359839247',
'zoom' => '12',
),
'restrict' => array(
'restrictextent' => 0,
'restrictedExtent' => '',
),
),
'behaviors' => array(
'openlayers_behavior_attribution' => array(),
'openlayers_behavior_argparser' => array(),
'openlayers_behavior_fullscreen' => array(),
'openlayers_behavior_keyboarddefaults' => array(),
'openlayers_behavior_layerswitcher' => array(),
'openlayers_behavior_navigation' => array(
'zoomWheelEnabled' => 1,
),
'openlayers_behavior_panzoombar' => array(),
'openlayers_behavior_permalink' => array(),
'openlayers_behavior_zoomtolayer' => array(
'zoomtolayer' => 'map_openlayers_1',
'point_zoom_level' => '5',
),
'openlayers_behavior_shapeselect' => array(),
),
'default_layer' => 'google_physical',
'layers' => array(
'google_physical' => 'google_physical',
'virtualearth_street' => 'virtualearth_street',
'osm_mapnik' => 'osm_mapnik',
'neighborhoods_openlayers_1' => 'neighborhoods_openlayers_1',
),
'layer_styles' => array(),
'layer_activated' => array(
'neighborhoods_openlayers_1' => 'neighborhoods_openlayers_1',
),
'layer_switcher' => array(),
'projection' => '900913',
'displayProjection' => '4326',
'styles' => array(
'default' => 'neighborhoods_unselected',
'select' => 'neighborhoods_selected',
'temporary' => 'default',
),
'options' => NULL,
);
$items["neighborhoods_display"] = $openlayers_map_presets;
return $items;
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | openlayers-828528.patch | 997 bytes | tom_o_t |
Comments
Comment #1
tom_o_t commentedI see two options:
1) Make the 'identifier' in the schema in the .install match the table name
2) Call ctools_export_get_schema() in openlayers_ui.module and get the correct 'identifier' and use that instead of $api on line 521
Comment #2
tom_o_t commentedPatch fixes this, taking 2nd approach as discussed in #1 above.
Comment #3
tmcw commentedExcellent, thanks for looking into this. I'll test this tonight and check that it works with drush and features and crew. Looks good so far.
Comment #4
tmcw commentedTested + committed: http://drupal.org/cvs?commit=386010
Thanks for the patch!