Location: PHPKode > projects > The Fresh Toolkit > fresh-0.1.213/code_templates/actions/FFormAction.tpl
<?php
class /*$actionName*/Action extends Action
{
    private $form;
    public function getFForm() 
    {
        if ($this->form) return $this->form;
        $form = new FForm($this->getContext() , "/*$actionName*/Form");
        $this->form = $form;
        return $this->getFForm();
    }
    public function execute() 
    {
        if ($this->form->submitted()) {
            $this->form->addError("/*$actionName*/Form Submitted");
        }
        return $this->getDefaultView();
    }
    public function getDefaultView() 
    {
        $this->request->setAttribute('form', $this->form->form);
        return View::INPUT;
    }
    public function getRequestMethods() 
    {
        return Request::POST;
    }
    public function initialize($context) 
    {
        $parent = parent::initialize($context);
        $this->request = $context->getRequest();
        $this->user = $context->getUser();
        $this->controller = $context->getController();
        $this->Fresh = $this->request->getAttribute('FreshController');
        $this->getFForm();
        return $parent;
    }
}
?>
Return current item: The Fresh Toolkit