Differential D12444 Diff 29861 src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | if ($this->usable === null) { | ||||
->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
->withClasses(array($application_class)) | ->withClasses(array($application_class)) | ||||
->execute(); | ->execute(); | ||||
if (!$result) { | if (!$result) { | ||||
continue; | continue; | ||||
} | } | ||||
} | } | ||||
$source->setViewer($this->getViewer()); | |||||
$usable[] = $source; | $usable[] = $source; | ||||
} | } | ||||
$this->usable = $usable; | $this->usable = $usable; | ||||
} | } | ||||
return $this->usable; | return $this->usable; | ||||
} | } | ||||
protected function canEvaluateFunction($function) { | |||||
foreach ($this->getUsableDatasources() as $source) { | |||||
if ($source->canEvaluateFunction($function)) { | |||||
return true; | |||||
} | |||||
} | |||||
return parent::canEvaluateFunction($function); | |||||
} | |||||
protected function evaluateFunction($function, array $argv) { | |||||
foreach ($this->getUsableDatasources() as $source) { | |||||
if ($source->canEvaluateFunction($function)) { | |||||
return $source->evaluateFunction($function, $argv); | |||||
} | |||||
} | |||||
return parent::evaluateFunction($function, $argv); | |||||
} | |||||
public function renderFunctionTokens($function, array $argv_list) { | |||||
foreach ($this->getUsableDatasources() as $source) { | |||||
if ($source->canEvaluateFunction($function)) { | |||||
return $source->renderFunctionTokens($function, $argv_list); | |||||
} | |||||
} | |||||
return parent::renderFunctionTokens($function, $argv_list); | |||||
} | |||||
} | } |