Skip to content

Commit

Permalink
FEATURE Location Summary and Searchable fields (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirish authored Sep 6, 2024
1 parent 99b0b2a commit 02864f5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/Model/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
*/
Expand Down

0 comments on commit 02864f5

Please sign in to comment.