Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated docs #165

Merged
merged 4 commits into from
Jul 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions docs/en/code/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#Extending

To change how the front-end javascript displays the map the custom script with the unique id `locator_map_init_script`.
This example shows how to reference custom templates and a custom data location. It is recommended to copy the custom script from the [Locator Controller](../../../code/pages/Locator.php#L273-L298) and modify it.

```php
class Locator_ControllerExtension extends Extension
{

public function onAfterInit()
{
$load = 'autoGeocode: false,
fullMapStart: true,';
$kilometer = ($this->owner->data()->Unit == 'km') ? "lengthUnit: 'km'" : "lengthUnit: 'm'";
$modal = ($this->owner->data()->ModalWindow) ? 'modalWindow: true' : 'modalWindow: false';

Requirements::customScript("
$(function(){
$('#map-container').storeLocator({
{$load}
dataLocation: '{$this->owner->Link()}SimpleXML.xml',
listTemplatePath: '{$this->owner->listTemplate}',
infowindowTemplatePath: '{$this->owner->windowTemplate}',
originMarker: true,
visibleMarkersList: false,
storeLimit: -1,
maxDistance: true,
slideMap: false,
distanceAlert: -1,
{$kilometer},
{$modal},
mapID: 'map',
locationList: 'loc-list',
mapSettings: {
zoom: 0,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDoubleClickZoom: false,
scrollwheel: true,
navigationControl: false,
draggable: true
}
})
});",
"locator_map_init_script");
}
}
```

Please note that this will replace the script that is loaded.
More options for the javascript map options can be found [here](https://github.com/bjorn2404/jQuery-Store-Locator-Plugin).
4 changes: 3 additions & 1 deletion docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

See [User Guide](userguide/index.md) for information on using the Locator module in the CMS.

See [Importing Locations](userguide/import.md) for information on importing Location and Category records.
See [Importing Locations](userguide/import.md) for information on importing Location and Category records.

See [Extending](code/index.md) for information on how to extend some functionality.