Embedding maps in the templates

By default, UNLVSpatial is enabled in the Clean White template set. To enable it in other template sets, simply copy the relevant code from the Clean White templates. Refer to the section called “Custom template sets” for more information about template sets.

In the templates, UNLVSpatial works using three template helpers:

getHtmlGoogleMapsObject()

Renders a Google Map containing a point or rect representation of a single object, e.g. for object view. See the PHP API documentation or source code for optional method parameters.

getHtmlGoogleMapsObjectResults()

Renders a Google Map containing point or rect representations of multiple objects, e.g. for results view. See the PHP API documentation or source code for optional method parameters.

getHtmlGoogleMapsSpatialSearch()

Renders a search form containing a Google Map for spatial searching. Used in search view. See the PHP API documentation or source code for optional method parameters.

Before calling any of these methods, make sure to check whether the UNLVSpatial module is actually enabled, otherwise they will cause a fatal error. For example:

<?php if (DMModuleManager::getInstance()->isModuleEnabled("UNLVSpatial")): ?>
    <?php if (count($view->getHelper()->getSpatialObjects())): ?>
        <?php echo $view->getHelper()->getHtmlGoogleMapsObjectResults() ?>
    <?php endif ?>
<?php endif ?>