Skip to content

Commit

Permalink
ENHANCEMENT allow for setting location query class at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
muskie9 committed Oct 12, 2016
1 parent a0e23a9 commit 99c5024
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 99c5024

Please sign in to comment.