Elgg
Version master
|
Route registration service. More...
Public Member Functions | |
__construct (EventsService $events, RouteCollection $routes, UrlGenerator $generator) | |
Constructor. More... | |
register (string $name, array $params=[]) | |
Register a new route. More... | |
unregister (string $name) | |
Unregister a route by its name. More... | |
get (string $name) | |
Get route config from its name. More... | |
all () | |
Get all registered routes. More... | |
generateUrl (string $name, array $parameters=[]) | |
Generate a absolute URL for a named route. More... | |
resolveRouteParameters (string $name,\ElggEntity $entity=null, array $parameters=[]) | |
Populates route parameters from entity properties. More... | |
Protected Attributes | |
$events | |
$routes | |
$generator | |
Route registration service.
Definition at line 16 of file RouteRegistrationService.php.
Elgg\Router\RouteRegistrationService::__construct | ( | EventsService | $events, |
RouteCollection | $routes, | ||
UrlGenerator | $generator | ||
) |
Constructor.
EventsService | $events | Events service |
RouteCollection | $routes | Route collection |
UrlGenerator | $generator | URL Generator |
Definition at line 42 of file RouteRegistrationService.php.
Elgg\Router\RouteRegistrationService::all | ( | ) |
Get all registered routes.
Definition at line 187 of file RouteRegistrationService.php.
Elgg\Router\RouteRegistrationService::generateUrl | ( | string | $name, |
array | $parameters = [] |
||
) |
Generate a absolute URL for a named route.
string | $name | Route name |
array | $parameters | Query parameters |
Definition at line 199 of file RouteRegistrationService.php.
Elgg\Router\RouteRegistrationService::get | ( | string | $name | ) |
Get route config from its name.
string | $name | Route name |
Definition at line 179 of file RouteRegistrationService.php.
Elgg\Router\RouteRegistrationService::register | ( | string | $name, |
array | $params = [] |
||
) |
Register a new route.
Route paths can contain wildcard segments, i.e. /blog/owner/{username} To make a certain wildcard segment optional, add ? to its name, i.e. /blog/owner/{username?}
Wildcard requirements for common named variables such as 'guid' and 'username' will be set automatically.
string | $name | Unique route name This name can later be used to generate route URLs |
array | $params | Route parameters
|
InvalidArgumentException |
Definition at line 74 of file RouteRegistrationService.php.
Elgg\Router\RouteRegistrationService::resolveRouteParameters | ( | string | $name, |
\ElggEntity | $entity = null , |
||
array | $parameters = [] |
||
) |
Populates route parameters from entity properties.
Definition at line 229 of file RouteRegistrationService.php.
Elgg\Router\RouteRegistrationService::unregister | ( | string | $name | ) |
Unregister a route by its name.
string | $name | Name of the route |
Definition at line 168 of file RouteRegistrationService.php.
|
protected |
Definition at line 23 of file RouteRegistrationService.php.
|
protected |
Definition at line 33 of file RouteRegistrationService.php.
|
protected |
Definition at line 28 of file RouteRegistrationService.php.