protected function renderInput()
 {
     $name = $this->getName();
     $values = nonempty($this->getValue(), array());
     if ($this->getID()) {
         $id = $this->getID();
     } else {
         $id = celerity_generate_unique_node_id();
     }
     $placeholder = null;
     if (!$this->placeholder) {
         $placeholder = $this->getDefaultPlaceholder();
     }
     $template = new AphrontTokenizerTemplateView();
     $template->setName($name);
     $template->setID($id);
     $template->setValue($values);
     $username = null;
     if ($this->user) {
         $username = $this->user->getUsername();
     }
     if (!$this->disableBehavior) {
         Javelin::initBehavior('aphront-basic-tokenizer', array('id' => $id, 'src' => $this->datasource, 'value' => $values, 'limit' => $this->limit, 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'username' => $username, 'placeholder' => $placeholder));
     }
     return $template->render();
 }
 protected function renderInput()
 {
     $name = $this->getName();
     $values = nonempty($this->getValue(), array());
     assert_instances_of($values, 'PhabricatorObjectHandle');
     if ($this->getID()) {
         $id = $this->getID();
     } else {
         $id = celerity_generate_unique_node_id();
     }
     $placeholder = null;
     if (!strlen($this->placeholder)) {
         if ($this->datasource) {
             $placeholder = $this->datasource->getPlaceholderText();
         }
     } else {
         $placeholder = $this->placeholder;
     }
     $template = new AphrontTokenizerTemplateView();
     $template->setName($name);
     $template->setID($id);
     $template->setValue($values);
     $username = null;
     if ($this->user) {
         $username = $this->user->getUsername();
     }
     $datasource_uri = null;
     if ($this->datasource) {
         $datasource_uri = $this->datasource->getDatasourceURI();
     }
     if (!$this->disableBehavior) {
         Javelin::initBehavior('aphront-basic-tokenizer', array('id' => $id, 'src' => $datasource_uri, 'value' => mpull($values, 'getFullName', 'getPHID'), 'icons' => mpull($values, 'getIcon', 'getPHID'), 'limit' => $this->limit, 'username' => $username, 'placeholder' => $placeholder));
     }
     return $template->render();
 }
 public function getPHUIXControlSpecification()
 {
     $datasource = $this->getDatasource();
     if (!$datasource) {
         return null;
     }
     $template = new AphrontTokenizerTemplateView();
     return array('markup' => $template->render(), 'config' => array('src' => $datasource->getDatasourceURI(), 'browseURI' => $datasource->getBrowseURI(), 'placeholder' => $datasource->getPlaceholderText()));
 }
 public function getPHUIXControlSpecification()
 {
     $template = new AphrontTokenizerTemplateView();
     $datasource = $this->getDatasource();
     $limit = $this->getLimit();
     $value = $this->getValue();
     if (!$value) {
         $value = array();
     }
     $value = $datasource->getWireTokens($value);
     return array('markup' => $template->render(), 'config' => array('src' => $datasource->getDatasourceURI(), 'browseURI' => $datasource->getBrowseURI(), 'placeholder' => $datasource->getPlaceholderText(), 'limit' => $limit), 'value' => $value);
 }
 protected function renderInput()
 {
     $name = $this->getName();
     $values = nonempty($this->getValue(), array());
     if ($this->getID()) {
         $id = $this->getID();
     } else {
         $id = celerity_generate_unique_node_id();
     }
     $template = new AphrontTokenizerTemplateView();
     $template->setName($name);
     $template->setID($id);
     $template->setValue($values);
     if (!$this->disableBehavior) {
         Javelin::initBehavior('aphront-basic-tokenizer', array('id' => $id, 'src' => $this->datasource, 'value' => $values, 'limit' => $this->limit));
     }
     return $template->render();
 }
 public function getPHUIXControlSpecification()
 {
     $datasource = $this->getDatasource();
     if (!$datasource) {
         return null;
     }
     $template = new AphrontTokenizerTemplateView();
     if ($this->getIsSingleValue()) {
         $limit = 1;
     } else {
         $limit = null;
     }
     $default = $this->getDefaultValue();
     if ($default) {
         $value = $datasource->getWireTokens($default);
     } else {
         $value = array();
     }
     return array('markup' => $template->render(), 'config' => array('src' => $datasource->getDatasourceURI(), 'browseURI' => $datasource->getBrowseURI(), 'placeholder' => $datasource->getPlaceholderText(), 'limit' => $limit), 'value' => $value);
 }
 protected function renderInput()
 {
     $name = $this->getName();
     $handles = $this->loadHandles();
     $handles = iterator_to_array($handles);
     if ($this->getID()) {
         $id = $this->getID();
     } else {
         $id = celerity_generate_unique_node_id();
     }
     $datasource = $this->datasource;
     if (!$datasource) {
         throw new Exception(pht('You must set a datasource to use a TokenizerControl.'));
     }
     $datasource->setViewer($this->getUser());
     $placeholder = null;
     if (!strlen($this->placeholder)) {
         $placeholder = $datasource->getPlaceholderText();
     }
     $values = nonempty($this->getValue(), array());
     $tokens = $datasource->renderTokens($values);
     foreach ($tokens as $token) {
         $token->setInputName($this->getName());
     }
     $template = new AphrontTokenizerTemplateView();
     $template->setName($name);
     $template->setID($id);
     $template->setValue($tokens);
     $username = null;
     if ($this->user) {
         $username = $this->user->getUsername();
     }
     $datasource_uri = $datasource->getDatasourceURI();
     $browse_uri = $datasource->getBrowseURI();
     if ($browse_uri) {
         $template->setBrowseURI($browse_uri);
     }
     if (!$this->disableBehavior) {
         Javelin::initBehavior('aphront-basic-tokenizer', array('id' => $id, 'src' => $datasource_uri, 'value' => mpull($tokens, 'getValue', 'getKey'), 'icons' => mpull($tokens, 'getIcon', 'getKey'), 'types' => mpull($tokens, 'getTokenType', 'getKey'), 'colors' => mpull($tokens, 'getColor', 'getKey'), 'limit' => $this->limit, 'username' => $username, 'placeholder' => $placeholder, 'browseURI' => $browse_uri));
     }
     return $template->render();
 }