AdministratorRouter
Extends RouterClass to create and parse routes
since |
1.5 |
---|---|
package |
Joomla CMS |
Methods
attachBuildRule
Attach a build rule
attachBuildRule(callable callback, string stage = self::PROCESS_DURING) : void
since |
1.5 |
---|
Arguments
- callback
callable
The function to be called- stage
string
The stage of the build process that this should be added to. Possible values: 'preprocess', '' for the main build process, 'postprocess'
attachParseRule
Attach a parse rule
attachParseRule(callable callback, string stage = self::PROCESS_DURING) : void
since |
1.5 |
---|
Arguments
- callback
callable
The function to be called.- stage
string
The stage of the parse process that this should be added to. Possible values: 'preprocess', '' for the main parse process, 'postprocess'
build
Function to convert an internal URI to a route
build(string|array|\Joomla\CMS\Uri\Uri url) : \Joomla\CMS\Uri\Uri
since |
1.5 |
---|
Arguments
- url
string|array|\Joomla\CMS\Uri\Uri
The internal URL or an associative array
Response
\Joomla\CMS\Uri\Uri
The absolute search engine friendly URL object
createUri
Create a uri based on a full or partial URL string
createUri(string url) : \Joomla\CMS\Uri\Uri
since |
3.2 |
---|
Arguments
- url
string
The URI or an associative array
Response
\Joomla\CMS\Uri\Uri
detachRule
Remove a rule
detachRule(string type, callable rule, string stage = self::PROCESS_DURING) : bool
since |
4.0.0 |
---|---|
throws |
|
Arguments
- type
string
Type of rule to remove (parse or build)- rule
callable
The rule to be removed.- stage
string
The stage of the parse process that this should be added to. Possible values: 'preprocess', '' for the main parse process, 'postprocess'
Response
bool
Was a rule removed?
getInstance
Returns the global Router object, only creating it if it doesn't already exist.
getInstance(string client, array options = array()) : \Joomla\CMS\Router\Router
since |
1.5 |
---|---|
throws |
|
deprecated |
5.0 Inject the router or load it from the dependency injection container |
Arguments
- client
string
The name of the client- options
array
An associative array of options
Response
\Joomla\CMS\Router\Router
A Router object.
getRules
Get all currently attached rules
getRules() : array
since |
4.0.0 |
---|
Response
array
All currently attached rules in an array
getVar
Get a router variable
getVar(string key) : mixed
since |
1.5 |
---|
Arguments
- key
string
The name of the variable
Response
mixed
Value of the variable
getVars
Get the router variable array
getVars() : array
since |
1.5 |
---|
Response
array
An associative array of router variables
parse
Function to convert a route to an internal URI
parse(\Joomla\CMS\Uri\Uri &uri, bool setVars = false) : array
since |
1.5 |
---|---|
throws |
|
Arguments
- uri
\Joomla\CMS\Uri\Uri
The uri.- setVars
bool
Set the parsed data in the internal storage for current-request-URLs
Response
array
processBuildRules
Process the build uri query data based on custom defined rules
processBuildRules(\Joomla\CMS\Uri\Uri &uri, string stage = self::PROCESS_DURING) : void
since |
3.2 |
---|
Arguments
- uri
\Joomla\CMS\Uri\Uri
The URI- stage
string
The stage that should be processed. Possible values: 'preprocess', 'postprocess' and '' for the main build stage
processParseRules
Process the parsed router variables based on custom defined rules
processParseRules(\Joomla\CMS\Uri\Uri &uri, string stage = self::PROCESS_DURING) : void
since |
3.2 |
---|
Arguments
- uri
\Joomla\CMS\Uri\Uri
The URI to parse- stage
string
The stage that should be processed. Possible values: 'preprocess', 'postprocess' and '' for the main parse stage
setVar
Set a router variable, creating it if it doesn't exist
setVar(string key, mixed value, bool create = true) : void
since |
1.5 |
---|
Arguments
- key
string
The name of the variable- value
mixed
The value of the variable- create
bool
If True, the variable will be created if it doesn't exist yet
setVars
Set the router variable array
setVars(array vars = array(), bool merge = true) : void
since |
1.5 |
---|
Arguments
- vars
array
An associative array with variables- merge
bool
If True, the array will be merged instead of overwritten
Constants
PROCESS_BEFORE
Mask for the before process stage
Value | 'preprocess' |
---|---|
since |
3.4 |
Type(s)
string
PROCESS_DURING
Mask for the during process stage
Value | '' |
---|---|
since |
3.4 |
Type(s)
string
PROCESS_AFTER
Mask for the after process stage
Value | 'postprocess' |
---|---|
since |
3.4 |
Type(s)
string