Path: blob/master/src/infrastructure/customfield/datasource/PhabricatorCustomFieldApplicationSearchAnyFunctionDatasource.php
12242 views
<?php12final class PhabricatorCustomFieldApplicationSearchAnyFunctionDatasource3extends PhabricatorTypeaheadDatasource {45public function getBrowseTitle() {6return pht('Browse Any');7}89public function getPlaceholderText() {10return pht('Type "any()"...');11}1213public function getDatasourceApplicationClass() {14return null;15}1617public function getDatasourceFunctions() {18return array(19'any' => array(20'name' => pht('Any Value'),21'summary' => pht('Find results with any value.'),22'description' => pht(23"This function includes results which have any value. Use a query ".24"like this to find results with any value:\n\n%s",25'> any()'),26),27);28}2930public function loadResults() {31$results = array(32$this->newAnyFunction(),33);34return $this->filterResultsAgainstTokens($results);35}3637protected function evaluateFunction($function, array $argv_list) {38$results = array();3940foreach ($argv_list as $argv) {41$results[] = new PhabricatorQueryConstraint(42PhabricatorQueryConstraint::OPERATOR_ANY,43null);44}4546return $results;47}4849public function renderFunctionTokens($function, array $argv_list) {50$results = array();51foreach ($argv_list as $argv) {52$results[] = PhabricatorTypeaheadTokenView::newFromTypeaheadResult(53$this->newAnyFunction());54}55return $results;56}5758private function newAnyFunction() {59$name = pht('Any Value');60return $this->newFunctionResult()61->setName($name.' any')62->setDisplayName($name)63->setIcon('fa-circle-o')64->setPHID('any()')65->setUnique(true)66->addAttribute(pht('Select results with any value.'));67}6869}707172