diff --git a/src/Model/Location.php b/src/Model/Location.php index d7b3aa0..03618df 100644 --- a/src/Model/Location.php +++ b/src/Model/Location.php @@ -76,6 +76,30 @@ class Location extends DataObject 'Links', ]; + /** + * @var array + * @config + */ + private static $summary_fields = [ + 'Title', + 'FullAddress' => 'Address', + 'CategoryList' => 'Categories', + 'Lat', + 'Lng', + ]; + + /** + * @var array + * @config + */ + private static $searchable_fields = [ + 'Title', + 'City', + 'State', + 'PostalCode', + 'Country', + ]; + /** * @var array * @config @@ -85,6 +109,15 @@ class Location extends DataObject AddressDataExtension::class, ]; + public function getCategoryList() + { + if ($this->Categories()->count()) { + return implode(', ', $this->Categories()->column('Title')); + } + + return ''; + } + /** * @return FieldList */