PHPackages                             gorriecoe/silverstripe-directionslink - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. gorriecoe/silverstripe-directionslink

ActiveSilverstripe-vendormodule

gorriecoe/silverstripe-directionslink
=====================================

Adds a directions link type to Link Object.

13PHP

Since Apr 15Pushed 6y ago1 watchersCompare

[ Source](https://github.com/gorriecoe/silverstripe-directionslink)[ Packagist](https://packagist.org/packages/gorriecoe/silverstripe-directionslink)[ RSS](/packages/gorriecoe-silverstripe-directionslink/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Silverstripe directions link
============================

[](#silverstripe-directions-link)

Adds a direction link type to [gorriecoe/silverstripe-link](https://github.com/gorriecoe/silverstripe-link). Allowing editor to select a location on google maps, that will then produce a google maps direction link.

Installation
------------

[](#installation)

Composer is the recommended way of installing SilverStripe modules.

```
composer require gorriecoe/silverstripe-directionslink

```

Directions link uses [GoogleMapField](https://github.com/BetterBrief/silverstripe-googlemapfield). So you will need to configure this in your config.yml.

```
BetterBrief\GoogleMapField:
  default_options:
    api_key: '[google-api-key]'

```

For more information check out [BetterBrief\\GoogleMapField](https://github.com/BetterBrief/silverstripe-googlemapfield).

Requirements
------------

[](#requirements)

- [gorriecoe/silverstripe-link](https://github.com/gorriecoe/silverstripe-link) ^1.2.3

Maintainers
-----------

[](#maintainers)

- [Gorrie Coe](https://github.com/gorriecoe)

Example
-------

[](#example)

Below are examples of link output:

- [Amberly NZ](https://maps.google.com/maps?saddr=Current+Location&daddr=-43.15577642393746/172.72987286045432)
- [Feilding NZ](https://maps.google.com/maps?saddr=Current+Location&daddr=-40.22610854373743/175.568486474398)

Open in apple maps if iProduct
------------------------------

[](#open-in-apple-maps-if-iproduct)

Below is a basic example that can be added to the frontend of your project to detect apple devices and open the link in apple maps instead.

```
var googlemapsurl = "https://maps.google.com/maps:";
var links = document.querySelectorAll('a[href*="' + googlemapsurl +'"]'), i;
for (i = 0; i
