Changeset View
Changeset View
Standalone View
Standalone View
src/view/form/control/AphrontFormTokenizerControl.php
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | protected function renderInput() { | ||||
$datasource = $this->datasource; | $datasource = $this->datasource; | ||||
if (!$datasource) { | if (!$datasource) { | ||||
throw new Exception( | throw new Exception( | ||||
pht('You must set a datasource to use a TokenizerControl.')); | pht('You must set a datasource to use a TokenizerControl.')); | ||||
} | } | ||||
$datasource->setViewer($this->getUser()); | $datasource->setViewer($this->getUser()); | ||||
$placeholder = null; | $placeholder = null; | ||||
if (!strlen($this->placeholder)) { | if (!phutil_nonempty_string($this->placeholder)) { | ||||
valerio.bozzolan: ✅ I was not able to test a value with `$this->placeholder` != null, but it seems to me that the… | |||||
$placeholder = $datasource->getPlaceholderText(); | $placeholder = $datasource->getPlaceholderText(); | ||||
} | } | ||||
$values = nonempty($this->getValue(), array()); | $values = nonempty($this->getValue(), array()); | ||||
$tokens = $datasource->renderTokens($values); | $tokens = $datasource->renderTokens($values); | ||||
foreach ($tokens as $token) { | foreach ($tokens as $token) { | ||||
$token->setInputName($this->getName()); | $token->setInputName($this->getName()); | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
✅ I was not able to test a value with $this->placeholder != null, but it seems to me that the intended usage is with string.
The method phutil_nonempty_string() will report alien types, and this is OK.