Changeset View
Changeset View
Standalone View
Standalone View
src/applications/settings/setting/PhabricatorSearchScopeSetting.php
<?php | <?php | ||||
final class PhabricatorSearchScopeSetting | final class PhabricatorSearchScopeSetting | ||||
extends PhabricatorInternalSetting { | extends PhabricatorSelectSetting { | ||||
const SETTINGKEY = 'search-scope'; | const SETTINGKEY = 'search-scope'; | ||||
public function getSettingName() { | public function getSettingName() { | ||||
return pht('Search Scope'); | return pht('Search Scope'); | ||||
} | } | ||||
public function getSettingPanelKey() { | |||||
return PhabricatorSearchSettingsPanel::PANELKEY; | |||||
} | |||||
public function getSettingDefaultValue() { | public function getSettingDefaultValue() { | ||||
return 'all'; | return 'all'; | ||||
} | } | ||||
protected function getControlInstructions() { | |||||
return pht( | |||||
'Choose the default behavior of the global search in the main menu.'); | |||||
} | |||||
protected function getSelectOptions() { | |||||
$scopes = PhabricatorMainMenuSearchView::getGlobalSearchScopeItems( | |||||
$this->getViewer(), | |||||
new PhabricatorSettingsApplication()); | |||||
$scope_map = array(); | |||||
foreach ($scopes as $scope) { | |||||
if (!isset($scope['value'])) { | |||||
continue; | |||||
} | |||||
$scope_map[$scope['value']] = $scope['name']; | |||||
} | |||||
return $scope_map; | |||||
} | |||||
} | } |