-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add documentation for loadPlugin() #5025
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
Conversation
| match. | ||
| * ``Cake\Routing\RouteBuilder`` now has methods to create routes for | ||
| specific HTTP methods. e.g ``get()`` and ``post()``. | ||
| * ``Cake\Routing\RouteBuilder::loadPlugin()`` was added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the deprecation of Plugin::routes() missing? Or don't we deprecate it now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking we don't deprecate it based on the discussion we had about making plugin routes more complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine, but then https://github.com/cakephp/cakephp/pull/10711/files#diff-7997caf44fa801d62e790043f405bd34R332 needs to be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine, but https://github.com/cakephp/cakephp/pull/10711/files#diff-7997caf44fa801d62e790043f405bd34R332 needs to be removed then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Thank you.
en/plugins.rst
Outdated
| 'ContactManager', | ||
| ['path' => '/contact-manager'], | ||
| function ($routes) { | ||
| $routes->fallbacks(DashedRoute::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be add one plugin specific rule plus the fallbacks? Might help envision what one can do with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
en/plugins.rst
Outdated
| } | ||
| ); | ||
|
|
||
| The above will connect default routes for you plugin. You can customize this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add another route, this would need to change a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"for youR plugin"
en/plugins.rst
Outdated
|
|
||
| Router::scope('/', function ($routes) { | ||
| // Connect other routes. | ||
| $routes->scope('/a', function ($routes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be not /a...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would you suggest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be a locale, like de_DE or may be api as it was used on https://book.cakephp.org/3.0/en/development/routing.html#using-named-routes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a /backend path segment.
en/plugins.rst
Outdated
| }); | ||
| }); | ||
|
|
||
| The above would result in URLs like ``/a/contact_manager/contacts``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/a ...
|
|
||
| If you are using ``Plugin::loadAll()`` ensure that routes are loaded:: | ||
|
|
||
| Plugin::loadAll(['routes' => true]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, we do not recommend this anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate loadAll() personally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me, as it is mentioned in other places on that page, anyway.
ravage84
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
Refs cakephp/cakephp#10711