Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route callbacks #343

Open
1 task
johanjanssens opened this issue May 15, 2020 · 0 comments · May be fixed by #344
Open
1 task

Route callbacks #343

johanjanssens opened this issue May 15, 2020 · 0 comments · May be fixed by #344
Assignees
Labels

Comments

@johanjanssens
Copy link
Member

johanjanssens commented May 15, 2020

Add support for callbacks to the router to further improve flexibility and make it possible to extend the routing logic.

Todo

  • Test caching and ensure redirects requests are correctly cached
@johanjanssens johanjanssens added this to the 0.18.0 milestone May 15, 2020
@johanjanssens johanjanssens self-assigned this May 15, 2020
johanjanssens added a commit that referenced this issue May 15, 2020
This allows pages to be to redirect any url, anywhere, even when not
in a page context.
johanjanssens added a commit that referenced this issue May 15, 2020
identifiers by a custom scheme and rename 'pages' scheme to 'page'
johanjanssens added a commit that referenced this issue May 15, 2020
The callback is defined is as follows: 'function($route, $generate = false)'

- $route: a ComPagesDispatcherRouteRouteInterface object
- $generate: are we generating a url or resolving (default false)

Callbacks are both supported for static and dynamic routes, in case of a
dynamic route the callback is called only if the route could be succesfully
resolved.
@johanjanssens johanjanssens removed this from the 0.18.0 milestone May 15, 2020
johanjanssens added a commit that referenced this issue May 16, 2020
Example:

'/path/to/page' => [
	'generate' => function($route)
	{
		return true;
	},
	'resolve' => function($route)
	{
		return true;
	}
],
@johanjanssens johanjanssens changed the title Add support for route callbacks Route callbacks May 16, 2020
@johanjanssens johanjanssens linked a pull request Jun 28, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant