Currently:

  // Hook to alter map.
  // Styles, behaviors, layers may all be added here.
  drupal_alter('openlayers_postrender', $map);

  // styles and layer styles are not required parameters
  $map['styles'] = isset($map['styles']) ? 
    $map['styles'] : array();
  $map['layer_styles'] = isset($map['layer_styles']) ? 
    $map['layer_styles'] : array();

  // Assign an ID
  $map['id'] = !isset($map['id']) ? 
    _openlayers_create_map_id() : $map['id'];
  $map['layers'] = _openlayers_layers_process($map['layers'], $map);
  $map['behaviors'] = _openlayers_behaviors_render($map['behaviors'], $map);
  $map['styles'] = _openlayers_styles_process($map['styles'], $map['layer_styles'], $map);

  // Hook to alter map one last time
  // Final modification to existing styles, behaviors, layers can happen here,
  // but nothing new may be added.
  drupal_alter('openlayers', $map);

Notice that the postrender hook comes before the actual rendering. I'll have to look for the discussion but I believe we had already decided to leave the openlayers_alter after the rendering, and use a openlayers_prerender_alter before. I'll have to double check, but nonetheless this needs to be updated and documented.

Comments

zzolo’s picture

Also, please note that somewhere along the line:

drupal_alter('openlayers_map', $map);

Change to this:

drupal_alter('openlayers', $map);

It should be back the old way as we are altering a map, not openlayers as a whole.

zzolo’s picture

Status: Active » Fixed

http://drupal.org/cvs?commit=362214

Updated map alters to:
* hook_openlayers_map_preprocess_alter(&$map)
* hook_openlayers_map_alter(&$map)

Updated documentation:
* Put openlayers.api.php back in as this the best mechanism to provide doxygen formatted documentation for hooks. This could be flushed out some more. Ideally this could mostly just link to handbook pages.
* Updated CHANGELOG.txt

Provided test

Status: Fixed » Closed (fixed)

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