Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Create an openlayers.api.php file to document hooks provided by Openlayers.
Original description:
Is there any way to dynamically alter objects in the new Openlayers 3.x? In 2.x, there was hook_openlayers_map_preprocess_alter() for altering a map before it is rendered.
For my specific use case, I would like to provide a map in module A, and alter it in module B (so that module B can be turned on/off, and the alteration will do the same).
Comments
Comment #1
m.stentaAh ha... I found two drupal_alter()s:
In \Drupal\openlayers\Types\Object->preBuild()
drupal_alter('openlayers_object_preprocess', $build, $this);
And ...->postBuild()
drupal_alter('openlayers_object_postprocess', $build, $this);
I will give that a try.
Should there be an openlayers.API.php to document these? Are there other hooks or alters available?
Comment #2
PolHello,
Yes indeed, you have the
preBuild()
andpostBuild()
methods, but you also have thehook_openlayers_object_postprocess_alter()
andhook_openlayers_object_preprocess_alter()
.And yes this should be defined in a .api.php file...
Comment #3
m.stenta(Updating issue title and description.)
Comment #4
m.stentaI think this is done.