Beispiel #1
0
 /**
  * @param string[optional] $name Name of the form.
  * @param string[optional] $action The action (URL) whereto the form will be submitted, if not provided it will be autogenerated.
  * @param string[optional] $method The method to use when submiting the form, default is POST.
  * @param bool[optional] $useToken Should we automagically add a formtoken?
  * @param bool[optional] $useGlobalError Should we automagically show a global error?
  */
 public function __construct($name = null, $action = null, $method = 'post', $useToken = true, $useGlobalError = true)
 {
     if (Spoon::exists('url')) {
         $this->URL = Spoon::get('url');
     }
     if (Spoon::exists('header')) {
         $this->header = Spoon::get('header');
     }
     $this->useGlobalError = (bool) $useGlobalError;
     // build a name if there wasn't one provided
     $name = $name === null ? SpoonFilter::toCamelCase($this->URL->getModule() . '_' . $this->URL->getAction(), '_', true) : (string) $name;
     // build the action if it wasn't provided
     $action = $action === null ? '/' . $this->URL->getQueryString() : (string) $action;
     // call the real form-class
     parent::__construct($name, $action, $method, $useToken);
     // add default classes
     $this->setParameter('id', $name);
     $this->setParameter('class', 'forkForms submitWithLink');
 }