Changeset View
Changeset View
Standalone View
Standalone View
src/view/form/control/AphrontFormTokenizerControl.php
<?php | <?php | ||||
final class AphrontFormTokenizerControl extends AphrontFormControl { | final class AphrontFormTokenizerControl extends AphrontFormControl { | ||||
private $datasource; | private $datasource; | ||||
private $disableBehavior; | private $disableBehavior; | ||||
private $limit; | private $limit; | ||||
private $placeholder; | private $placeholder; | ||||
private $handles; | private $handles; | ||||
private $originalValue; | private $initialValue; | ||||
public function setDatasource(PhabricatorTypeaheadDatasource $datasource) { | public function setDatasource(PhabricatorTypeaheadDatasource $datasource) { | ||||
$this->datasource = $datasource; | $this->datasource = $datasource; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setDisableBehavior($disable) { | public function setDisableBehavior($disable) { | ||||
$this->disableBehavior = $disable; | $this->disableBehavior = $disable; | ||||
Show All 9 Lines | public function setLimit($limit) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setPlaceholder($placeholder) { | public function setPlaceholder($placeholder) { | ||||
$this->placeholder = $placeholder; | $this->placeholder = $placeholder; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setOriginalValue(array $original_value) { | public function setInitialValue(array $initial_value) { | ||||
$this->originalValue = $original_value; | $this->initialValue = $initial_value; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getOriginalValue() { | public function getInitialValue() { | ||||
return $this->originalValue; | return $this->initialValue; | ||||
} | } | ||||
public function willRender() { | public function willRender() { | ||||
// Load the handles now so we'll get a bulk load later on when we actually | // Load the handles now so we'll get a bulk load later on when we actually | ||||
// render them. | // render them. | ||||
$this->loadHandles(); | $this->loadHandles(); | ||||
} | } | ||||
Show All 28 Lines | foreach ($tokens as $token) { | ||||
$token->setInputName($this->getName()); | $token->setInputName($this->getName()); | ||||
} | } | ||||
$template = id(new AphrontTokenizerTemplateView()) | $template = id(new AphrontTokenizerTemplateView()) | ||||
->setName($name) | ->setName($name) | ||||
->setID($id) | ->setID($id) | ||||
->setValue($tokens); | ->setValue($tokens); | ||||
$original_value = $this->getOriginalValue(); | $initial_value = $this->getInitialValue(); | ||||
if ($original_value !== null) { | if ($initial_value !== null) { | ||||
$template->setOriginalValue($original_value); | $template->setInitialValue($initial_value); | ||||
} | } | ||||
$username = null; | $username = null; | ||||
if ($this->user) { | if ($this->user) { | ||||
$username = $this->user->getUsername(); | $username = $this->user->getUsername(); | ||||
} | } | ||||
$datasource_uri = $datasource->getDatasourceURI(); | $datasource_uri = $datasource->getDatasourceURI(); | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |