Packages » Package freeform » Class Location

Class Location

Declaration:
<? class Location implements LocationRewriter ?>

Description:
This class is used to embed links to other actions into responce documents. It saves the document template designers from various quirks of creating complex hyperlinks within, for expample, the <a> tag. The document implementation tag serving as a link placeholder will simply call Location::toURL method and will get correct URL of the link. Freeform reserves the following parameter names so that you cannot use them for custom parameter names: action, hash, id and page.

Implemented Interfaces:
LocationRewriter

Authors:
  • Dennis Popel

Properties:

Methods:
  • __construct()
    Construct a Location object from action (either given as a string or an instance) and a set of parameters. You can omit the $action parameter (setting it to null) if you want to create link to default action.
  • decode()
    This method simply returns the $_GET array as there is no URL rewriting performed by this LocationRewriter
  • equals()
    Returns true if this location points to the same action as that specified by $l. Two location are equal if they point to same action and have same set of parameters.
  • getAction()
    Return the class name of action of this Location object
  • getAnchor()
    Get the anchor, if any
  • getParameter()
    Return a specified parameter
  • getParameters()
    Return parameters of this location
  • parseURL()
  • rewrite()
    This static method acts as the default location rewriter. It is inherited from the LocationRewriter interface and returns the URL of a location in default format. Note that this method is called only if other possible rewriters returned nulls.
  • setAnchor()
    Set the anchor for this location. On the page this location refers to the browser will try to scroll to this anchor (refers to the html documents only).
  • setParameter()
    It is possible to add parameters to existing Location instance so it is easy to generate links to same action with different parameters (like result set paginator). Values of already existing parameters will be overwritten with the new values.
  • toURL()
    Create an URL to access an action with a given set of parameters. This will use the classes specified in the locationRewriter config option of the freeform package to rewrite the URLs of other actions. If there are no rewriters configures, or all of them returned nulls, the default format for URLs will be used. If the $disableRewrite parameter is set to true, then the URL will always be in default format.