-building helper functions */ namespace HalfMoon; class FormHelperCommon extends Helper { public $controller = null; public $form_object = null; public $html_helper = null; public $form_prefix = null; public function __construct() { $this->html_helper = new HtmlHelper; } /* the guts of form_for() and form_tag() */ protected function output_form_around_closure($url_or_obj, $options = array(), \Closure $form_content) { if (!isset($options["method"])) $options["method"] = "post"; if (!empty($options["multipart"])) { unset($options["multipart"]); $options["enctype"] = "multipart/form-data"; } if (!empty($options["form_prefix"])) { $this->form_prefix = $options["form_prefix"]; unset($options["form_prefix"]); } print "options_to_s($options) . " action=\"" . h($this->html_helper->link_from_obj_or_string($url_or_obj)) . "\"" . ">"; if (strtolower($options["method"]) != "get") print "controller->form_authenticity_token()) . "\"" . " />"; print Utils::to_s($this, $form_content, $this->controller); print ""; $this->form_object = null; return $this; } /* generate