Path: blob/master/src/view/form/control/AphrontFormHandlesControl.php
12256 views
<?php12final class AphrontFormHandlesControl extends AphrontFormControl {34private $isInvisible;56protected function getCustomControlClass() {7return 'aphront-form-control-handles';8}910public function setIsInvisible($is_invisible) {11$this->isInvisible = $is_invisible;12return $this;13}1415public function getIsInvisible() {16return $this->isInvisible;17}1819protected function shouldRender() {20return (bool)$this->getValue();21}2223public function getLabel() {24// TODO: This is a bit funky and still rendering a few pixels of padding25// on the form, but there's currently no way to get a control to only emit26// hidden inputs. Clean this up eventually.2728if ($this->getIsInvisible()) {29return null;30}3132return parent::getLabel();33}3435protected function renderInput() {36$value = $this->getValue();37$viewer = $this->getUser();3839$out = array();4041if (!$this->getIsInvisible()) {42$list = $viewer->renderHandleList($value);43$list = id(new PHUIBoxView())44->addPadding(PHUI::PADDING_SMALL_TOP)45->appendChild($list);46$out[] = $list;47}4849$inputs = array();50foreach ($value as $phid) {51$inputs[] = phutil_tag(52'input',53array(54'type' => 'hidden',55'name' => $this->getName().'[]',56'value' => $phid,57));58}59$out[] = $inputs;6061return $out;62}6364}656667