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

Filter parameters #30

Closed
MGatner opened this issue Mar 29, 2019 · 6 comments
Closed

Filter parameters #30

MGatner opened this issue Mar 29, 2019 · 6 comments

Comments

@MGatner
Copy link
Collaborator

MGatner commented Mar 29, 2019

Filters can take parameters?? Anywhere this is documented? I dug through the CI4 Router code but there’s a lot of different pieces there...

@lonnieezell
Copy link
Owner

Yeah, the Router has gotten a bit complex :)

I actually built the feature for it to support parameters based on me making this auth-lib. One of the benefits of developing the core at the same time. It doesn't look like that got in the docs, though. The ability to use filters in route groups made it in, but not the ability to have parameters in the docs.

Thanks for pointing that out. Will have to remedy that!

@MGatner
Copy link
Collaborator Author

MGatner commented Mar 29, 2019

That’s great! Definitely a needed feature. It looks like it is basically filterName:parameter - I do see that it can receive multiple parameters so is that a CSV? Also, any chance it can take dynamic parameters? E.g. a segment of the route (if you wanted a filter to respond differently based on the target content)

@lonnieezell
Copy link
Owner

That is the correct format, and yes it supports CSV. Dynamic values is not currently supported, and I didn't have any plans to, either, but I wouldn't turn away a well thought-out PR for that :) Though that could start getting pretty complex considering the location in the flow that routing occupies....

@MGatner
Copy link
Collaborator Author

MGatner commented Mar 29, 2019

Great - I’ll work up a PR for the user docs and give some thought to dynamic parameter values. Thanks for the feedback.

@MGatner MGatner closed this as completed Mar 29, 2019
@MGatner
Copy link
Collaborator Author

MGatner commented Apr 2, 2019

After poking at this for a while, I kept coming back to the same conclusion: Dynamic filter parameters is replicating controller functionality which should probably stay with the controller. Parameters (generally) are awesome because they save a lot of potential duplicate code across controllers and controller methods, so I will still send over a PR for the user docs on that.

@MGatner
Copy link
Collaborator Author

MGatner commented Apr 2, 2019

Parameters don't seem to be supported by app/Config/Filters.php - does that seem correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants