Changeset View
Changeset View
Standalone View
Standalone View
src/view/form/control/AphrontFormPolicyControl.php
Show All 33 Lines | public function setTemplatePHIDType($type) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setTemplateObject($object) { | public function setTemplateObject($object) { | ||||
$this->templateObject = $object; | $this->templateObject = $object; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getSerializedValue() { | |||||
return json_encode(array( | |||||
$this->getValue(), | |||||
$this->getSpacePHID(), | |||||
)); | |||||
} | |||||
public function readSerializedValue($value) { | |||||
$decoded = phutil_json_decode($value); | |||||
$policy_value = $decoded[0]; | |||||
$space_phid = $decoded[1]; | |||||
$this->setValue($policy_value); | |||||
$this->setSpacePHID($space_phid); | |||||
return $this; | |||||
} | |||||
public function readValueFromDictionary(array $dictionary) { | public function readValueFromDictionary(array $dictionary) { | ||||
// TODO: This is a little hacky but will only get us into trouble if we | // TODO: This is a little hacky but will only get us into trouble if we | ||||
// have multiple view policy controls in multiple paged form views on the | // have multiple view policy controls in multiple paged form views on the | ||||
// same page, which seems unlikely. | // same page, which seems unlikely. | ||||
$this->setSpacePHID(idx($dictionary, 'spacePHID')); | $this->setSpacePHID(idx($dictionary, 'spacePHID')); | ||||
return parent::readValueFromDictionary($dictionary); | return parent::readValueFromDictionary($dictionary); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 294 Lines • Show Last 20 Lines |