/** * Returns the currently attached form object. * @param string $id The unique id of the form to detach * @return TForm the reference to the currently attached form object */ public function getForm($id = '') { // If given an id, return the specified one from the forms list. if (strlen($id)) { if (!isset($this->forms[$id])) { if (is_null($this->masterPage)) { return null; } return $this->masterPage->getForm($id); } return $this->forms[$id]; } return is_null($this->form) && !is_null($this->masterPage) ? $this->masterPage->getForm() : $this->form; }