Skip to content

Commit

Permalink
MINOR Use SolrTypeConfiguration data to display additional types to b…
Browse files Browse the repository at this point in the history
…e searched on via normal search pages
  • Loading branch information
Marcus Nyeholt committed Mar 23, 2012
1 parent 24fa40e commit 1913402
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
@@ -1,3 +1,10 @@
2012-03-23 v0.7.1
-----------------

* Use the SolrTypeConfiguration in the list of types a page can search
on


2012-01-27 v0.7.0 2012-01-27 v0.7.0
----------------- -----------------


Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.7.0 0.7.1
12 changes: 11 additions & 1 deletion code/pages/SolrSearchPage.php
Expand Up @@ -88,9 +88,19 @@ public function getCMSFields() {
asort($source); asort($source);
$source = array_merge(array('' => 'Any'), $source); $source = array_merge(array('' => 'Any'), $source);


// add in any explicitly configured
$objects = DataObject::get('SolrTypeConfiguration');
if ($objects) {
foreach ($objects as $obj) {
$source[$obj->Title] = $obj->Title;
}
}

ksort($source);

$source = array_merge($source, self::$additional_search_types); $source = array_merge($source, self::$additional_search_types);


$optionsetField = new DropdownField('SearchType', _t('SolrSearchPage.PAGE_TYPE', 'Search pages of type'), $source, 'Any'); $optionsetField = new DropdownField('SearchType', _t('SolrSearchPage.SEARCH_ITEM_TYPE', 'Search items of type'), $source, 'Any');
$fields->addFieldToTab('Root.Content.Main', $optionsetField, 'Content'); $fields->addFieldToTab('Root.Content.Main', $optionsetField, 'Content');


$fields->addFieldToTab('Root.Content.Main', new MultiValueDropdownField('SearchOnFields', _t('SolrSearchPage.INCLUDE_FIELDS', 'Search On Fields'), $objFields), 'Content'); $fields->addFieldToTab('Root.Content.Main', new MultiValueDropdownField('SearchOnFields', _t('SolrSearchPage.INCLUDE_FIELDS', 'Search On Fields'), $objFields), 'Content');
Expand Down

0 comments on commit 1913402

Please sign in to comment.