public function GoogleMaps::postBuild in Openlayers 7.3
Invoked after an objects render array is built.
Mostly invoked by the map object.
Parameters
array $build: The array with the build information.
\Drupal\openlayers\Types\ObjectInterface $context: The context of the build. Mostly the map object.
Overrides Base::postBuild
File
- src/
Plugin/ Source/ GoogleMaps/ GoogleMaps.php, line 66 - Google maps API integration based on the example here: http://openlayers.org/en/v3.0.0/examples/google-map.html http://bl.ocks.org/elemoine/e82c7dd4b1d0ef45a9a4
Class
- GoogleMaps
- Class GoogleMaps.
Namespace
Drupal\openlayers\Plugin\Source\GoogleMapsCode
public function postBuild(array &$build, ObjectInterface $map = NULL) {
$styles = implode(array_map(function ($key) use ($map) {
return $key . ':' . $map
->getOption($key) . ';';
}, array(
'width',
'height',
)));
$build['map_suffix']['gmap'] = array(
'#type' => 'container',
'#attributes' => array(
'id' => 'gmap-' . $map
->getId(),
'class' => array(
'openlayers',
'gmap-map',
),
'style' => $styles,
),
);
}