Changeset View
Changeset View
Standalone View
Standalone View
src/view/form/control/AphrontFormTokenizerControl.php
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | protected function renderInput() { | ||||
} | } | ||||
$datasource->setViewer($this->getUser()); | $datasource->setViewer($this->getUser()); | ||||
$placeholder = null; | $placeholder = null; | ||||
if (!strlen($this->placeholder)) { | if (!strlen($this->placeholder)) { | ||||
$placeholder = $datasource->getPlaceholderText(); | $placeholder = $datasource->getPlaceholderText(); | ||||
} | } | ||||
$tokens = array(); | |||||
$values = nonempty($this->getValue(), array()); | $values = nonempty($this->getValue(), array()); | ||||
foreach ($values as $value) { | $tokens = $datasource->renderTokens($values); | ||||
if (isset($handles[$value])) { | |||||
$token = PhabricatorTypeaheadTokenView::newFromHandle($handles[$value]); | |||||
} else { | |||||
$token = null; | |||||
$function = $datasource->parseFunction($value); | |||||
if ($function) { | |||||
$token_list = $datasource->renderFunctionTokens( | |||||
$function['name'], | |||||
array($function['argv'])); | |||||
$token = head($token_list); | |||||
} | |||||
if (!$token) { | foreach ($tokens as $token) { | ||||
$name = pht('Invalid Function: %s', $value); | |||||
$token = $datasource->newInvalidToken($name); | |||||
} | |||||
$type = $token->getTokenType(); | |||||
if ($type == PhabricatorTypeaheadTokenView::TYPE_INVALID) { | |||||
$token->setKey($value); | |||||
} | |||||
} | |||||
$token->setInputName($this->getName()); | $token->setInputName($this->getName()); | ||||
$tokens[] = $token; | |||||
} | } | ||||
$template = new AphrontTokenizerTemplateView(); | $template = new AphrontTokenizerTemplateView(); | ||||
$template->setName($name); | $template->setName($name); | ||||
$template->setID($id); | $template->setID($id); | ||||
$template->setValue($tokens); | $template->setValue($tokens); | ||||
$username = null; | $username = null; | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |