Differential D12224 Diff 29377 src/applications/differential/customfield/DifferentialRepositoryField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/customfield/DifferentialRepositoryField.php
Show All 26 Lines | final class DifferentialRepositoryField | ||||
} | } | ||||
public function readValueFromRequest(AphrontRequest $request) { | public function readValueFromRequest(AphrontRequest $request) { | ||||
$phids = $request->getArr($this->getFieldKey()); | $phids = $request->getArr($this->getFieldKey()); | ||||
$first = head($phids); | $first = head($phids); | ||||
$this->setValue(nonempty($first, null)); | $this->setValue(nonempty($first, null)); | ||||
} | } | ||||
public function getRequiredHandlePHIDsForEdit() { | |||||
$phids = array(); | |||||
if ($this->getValue()) { | |||||
$phids[] = $this->getValue(); | |||||
} | |||||
return $phids; | |||||
} | |||||
public function renderEditControl(array $handles) { | public function renderEditControl(array $handles) { | ||||
if ($this->getValue()) { | if ($this->getValue()) { | ||||
$control_value = array_select_keys($handles, array($this->getValue())); | $value = array($this->getValue()); | ||||
} else { | } else { | ||||
$control_value = array(); | $value = array(); | ||||
} | } | ||||
return id(new AphrontFormTokenizerControl()) | return id(new AphrontFormTokenizerControl()) | ||||
->setUser($this->getViewer()) | |||||
->setName($this->getFieldKey()) | ->setName($this->getFieldKey()) | ||||
->setDatasource(new DiffusionRepositoryDatasource()) | ->setDatasource(new DiffusionRepositoryDatasource()) | ||||
->setValue($control_value) | ->setValue($value) | ||||
->setError($this->getFieldError()) | ->setError($this->getFieldError()) | ||||
->setLabel($this->getFieldName()) | ->setLabel($this->getFieldName()) | ||||
->setLimit(1); | ->setLimit(1); | ||||
} | } | ||||
public function getApplicationTransactionRequiredHandlePHIDs( | public function getApplicationTransactionRequiredHandlePHIDs( | ||||
PhabricatorApplicationTransaction $xaction) { | PhabricatorApplicationTransaction $xaction) { | ||||
▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines |