dynamic/silverstripe-locator-frontend-react

View on GitHub
templates/Dynamic/Locator/Data/JSON.ss

Summary

Maintainability
Test Coverage
{
  "locations": [
    <% loop $Locations %>{
      "ID": $ID,
      "Title": "$Title.RAW",
      "Featured": "$Featured",
      "Website": "$WebsiteURL",
      "Phone": "$Phone",
      "Fax": "$Fax",
      "Email": "$Email",
      "Address": "$Address.RAW",
      "Address2": "$Address2.RAW",
      "City": "$City.RAW",
      "State": "$State",
      "PostalCode": "$PostalCode",
      "Country": "$Country",
      "Distance": <% if $Distance %>$Distance<% else %>-1<% end_if %>,
      "Lat": $Lat,
      "Lng": $Lng,
      <% if $Categories %>"Categories": $CategoryData.RAW,<% end_if %>
      "MarkerIcon": "$MarkerIcon"
    }<% if not $Last %>,<%end_if%><% end_loop %>
  ]<% if $AddressCoords %>,
  "center": {
    "Lat": $AddressCoords.Lat,
    "Lng": $AddressCoords.Lng
  }<% end_if %>
}