Path: blob/master/src/infrastructure/customfield/datasource/PhabricatorCustomFieldApplicationSearchNoneFunctionDatasource.php
12242 views
<?php12final class PhabricatorCustomFieldApplicationSearchNoneFunctionDatasource3extends PhabricatorTypeaheadDatasource {45public function getBrowseTitle() {6return pht('Browse No Value');7}89public function getPlaceholderText() {10return pht('Type "none()"...');11}1213public function getDatasourceApplicationClass() {14return null;15}1617public function getDatasourceFunctions() {18return array(19'none' => array(20'name' => pht('No Value'),21'summary' => pht('Find results with no value.'),22'description' => pht(23"This function includes results which have no value. Use a query ".24"like this to find results with no value:\n\n%s\n\n".25'If you combine this function with other constraints, results '.26'which have no value or the specified values will be returned.',27'> any()'),28),29);30}3132public function loadResults() {33$results = array(34$this->newNoneFunction(),35);36return $this->filterResultsAgainstTokens($results);37}3839protected function evaluateFunction($function, array $argv_list) {40$results = array();4142foreach ($argv_list as $argv) {43$results[] = new PhabricatorQueryConstraint(44PhabricatorQueryConstraint::OPERATOR_NULL,45null);46}4748return $results;49}5051public function renderFunctionTokens($function, array $argv_list) {52$results = array();53foreach ($argv_list as $argv) {54$results[] = PhabricatorTypeaheadTokenView::newFromTypeaheadResult(55$this->newNoneFunction());56}57return $results;58}5960private function newNoneFunction() {61$name = pht('No Value');62return $this->newFunctionResult()63->setName($name.' none')64->setDisplayName($name)65->setIcon('fa-ban')66->setPHID('none()')67->setUnique(true)68->addAttribute(pht('Select results with no value.'));69}7071}727374