Skip to content

Commit

Permalink
Merge pull request #125 from muskie9/enhancement/locationQueryClass
Browse files Browse the repository at this point in the history
ENHANCEMENT allow for setting location query class at runtime
  • Loading branch information
muskie9 authored Oct 13, 2016
2 parents a0e23a9 + 99c5024 commit fa53e85
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions code/pages/Locator.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class Locator extends Page
*/
private static $description = 'Find locations on a map';

/**
* @var string
*/
private static $location_class = 'Location';

/**
* @return FieldList
*/
Expand Down Expand Up @@ -98,7 +103,8 @@ public static function get_locations(
$callback = null
)
{
$locations = Location::get()->filter($filter)->exclude($exclude);
$locationClass = Config::inst()->get('Locator', 'location_class');
$locations = $locationClass::get()->filter($filter)->exclude($exclude);

if (!empty($filterAny)) {
$locations = $locations->filterAny($filterAny);
Expand Down Expand Up @@ -196,7 +202,7 @@ class Locator_Controller extends Page_Controller
/**
* @var DataList|ArrayList
*/
private $locations;
protected $locations;

/**
* Set Requirements based on input from CMS
Expand Down

0 comments on commit fa53e85

Please sign in to comment.