示例#1
0
 public function addControl(AphrontFormControl $control)
 {
     $name = $control->getName();
     if (!strlen($name)) {
         throw new Exception(pht('Form control has no name!'));
     }
     if (isset($this->controls[$name])) {
         throw new Exception(pht("Form page contains duplicate control with name '%s'!", $name));
     }
     $this->controls[$name] = $control;
     $this->content[] = $control;
     $control->setFormPage($this);
     return $this;
 }