Example #1
0
 /**
  * @param string $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 string[optional] $hash The id of the anchor to append to the action-URL.
  * @param bool[optional] $useToken Should we automagically add a formtoken?
  */
 public function __construct($name, $action = null, $method = 'post', $hash = null, $useToken = true)
 {
     $this->URL = Spoon::get('url');
     $this->header = Spoon::get('header');
     $name = (string) $name;
     $hash = $hash !== null ? (string) $hash : null;
     $useToken = (bool) $useToken;
     // 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');
 }
Example #2
0
 /**
  * Get the id of an item by the full URL of the current page.
  * Selects the proper part of the full URL to get the item's id from the database.
  *
  * @return	int					The id that corresponds with the given full URL.
  * @param	FrontendURL $URL	The current URL.
  */
 public static function getIdForTags(FrontendURL $URL)
 {
     // return the item
     return FrontendNavigation::getPageId($URL->getQueryString());
 }