Changeset View
Changeset View
Standalone View
Standalone View
src/applications/typeahead/view/PhabricatorTypeaheadTokenView.php
<?php | <?php | ||||
final class PhabricatorTypeaheadTokenView | final class PhabricatorTypeaheadTokenView | ||||
extends AphrontTagView { | extends AphrontTagView { | ||||
private $key; | private $key; | ||||
private $icon; | private $icon; | ||||
private $inputName; | private $inputName; | ||||
private $value; | private $value; | ||||
public static function newForTypeaheadResult( | const KEY_INVALID = '<invalid>'; | ||||
public static function newFromTypeaheadResult( | |||||
PhabricatorTypeaheadResult $result) { | PhabricatorTypeaheadResult $result) { | ||||
return id(new PhabricatorTypeaheadTokenView()) | return id(new PhabricatorTypeaheadTokenView()) | ||||
->setKey($result->getPHID()) | ->setKey($result->getPHID()) | ||||
->setIcon($result->getIcon()) | ->setIcon($result->getIcon()) | ||||
->setValue($result->getDisplayName()); | ->setValue($result->getDisplayName()); | ||||
} | } | ||||
public static function newFromHandle( | |||||
PhabricatorObjectHandle $handle) { | |||||
return id(new PhabricatorTypeaheadTokenView()) | |||||
->setKey($handle->getPHID()) | |||||
->setValue($handle->getFullName()) | |||||
->setIcon($handle->getIcon()); | |||||
} | |||||
public function setKey($key) { | public function setKey($key) { | ||||
$this->key = $key; | $this->key = $key; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getKey() { | public function getKey() { | ||||
return $this->key; | return $this->key; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |