Changeset View
Changeset View
Standalone View
Standalone View
src/applications/paste/typeahead/PasteLanguageSelectDatasource.php
- This file was added.
| <?php | |||||
| final class PasteLanguageSelectDatasource | |||||
| extends PhabricatorTypeaheadDatasource { | |||||
| public function getBrowseTitle() { | |||||
| return pht('Browse Languages'); | |||||
| } | |||||
| public function getPlaceholderText() { | |||||
| return pht('Type a language name or leave blank to auto-detect...'); | |||||
| } | |||||
epriestley: Oh, nice. | |||||
| public function getDatasourceApplicationClass() { | |||||
| return 'PhabricatorPasteApplication'; | |||||
| } | |||||
| public function loadResults() { | |||||
| $results = $this->buildResults(); | |||||
| return $this->filterResultsAgainstTokens($results); | |||||
| } | |||||
| protected function renderSpecialTokens(array $values) { | |||||
| return $this->renderTokensFromResults($this->buildResults(), $values); | |||||
| } | |||||
| private function buildResults() { | |||||
| $results = array(); | |||||
| $languages = PhabricatorEnv::getEnvConfig('pygments.dropdown-choices'); | |||||
| foreach ($languages as $value => $name) { | |||||
| $result = id(new PhabricatorTypeaheadResult()) | |||||
| ->setPHID($value) | |||||
| ->setName($name); | |||||
| $results[$value] = $result; | |||||
| } | |||||
| return $results; | |||||
| } | |||||
| } | |||||
Not Done Inline ActionsHaving this be an option doesn't make as much sense here as it does in a drop-down. I think the ideal functionality would be for it to attempt to auto-detect if the language field is left blank rather than having an explicit value for auto-detection. jcox: Having this be an option doesn't make as much sense here as it does in a drop-down. I think the… | |||||
Oh, nice.