Open Erwane opened 5 years ago
Thanks for the PR. Isn't this going to break the opposite case, i.e., if you have a POST URL and you are on a GET one?
There is no reason a POST only route need UrlComparerTrait for navlinks i thinks.
Maybe in case of ajax url in data-url
attribute ...
Another option is to parse RouteCollection and check url only for route allow current method ?
I agree with you regarding POST only links in a navigation bar but I would like the UrlComparatorTrait
to not be navbar-specific.
Honestly, I don't know why CakePHP has such behaviour... ServerRequest
is probably not the right tool for this job, but I have a hard time getting something clean... Comparing CakePHP urls is getting me crazy, this trait was meant to be a small utility tool but it is now probably the most complicated part of the whole helper set.
Hi. What we need to advance on this PR ?
@Erwane A possibility would be to let user specify the method used to compare, with a default to no-method in the UrlComparerTrait
(current behavior), but a default to GET
in the navbar helper.
This would be retro-compatible, and more flexible for future changes.
for issue #179