PHP Class Elgg\Router

Plugin devs should use these wrapper functions: * elgg_register_page_handler * elgg_unregister_page_handler
Since: 1.9.0
Afficher le fichier Open project: elgg/elgg Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( PluginHooksService $hooks ) Constructor
allowRewrite ( Request $request ) : Request Filter a request through the route:rewrite hook
getPageHandlers ( ) : array Get page handlers as array of identifier => callback
registerPageHandler ( string $identifier, string $function ) : boolean Register a function that gets called when the first part of a URL is equal to the identifier.
route ( Request $request ) : boolean Routes the request to a registered page handler
unregisterPageHandler ( string $identifier ) : void Unregister a page handler for an identifier

Method Details

__construct() public méthode

Constructor
public __construct ( PluginHooksService $hooks )
$hooks PluginHooksService For customized routing.

allowRewrite() public méthode

Filter a request through the route:rewrite hook
public allowRewrite ( Request $request ) : Request
$request Elgg\Http\Request Elgg request
Résultat Elgg\Http\Request

getPageHandlers() public méthode

Get page handlers as array of identifier => callback
public getPageHandlers ( ) : array
Résultat array

registerPageHandler() public méthode

Register a function that gets called when the first part of a URL is equal to the identifier.
public registerPageHandler ( string $identifier, string $function ) : boolean
$identifier string The page type to handle
$function string Your function name
Résultat boolean Depending on success

route() public méthode

This function triggers a plugin hook 'route', $identifier so that plugins can modify the routing or handle a request.
public route ( Request $request ) : boolean
$request Elgg\Http\Request The request to handle.
Résultat boolean Whether the request was routed successfully.

unregisterPageHandler() public méthode

Unregister a page handler for an identifier
public unregisterPageHandler ( string $identifier ) : void
$identifier string The page type identifier
Résultat void