Reputation: 4573
Since Router::promote();
has been removed in CakePHP 3, what should one be using to override routes set in Config/routes.php from a plugin?
Say that i would want to overwrite
$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
With
$routes->connect('/', ['plugin' => 'Plugin','controller' => 'Pages', 'action' => 'displayInPlugin']);
Upvotes: 1
Views: 843
Reputation: 4573
Solution was to simply put Plugin::routes();
over the default routes...d'oh.
Plugin::routes();
Router::scope('/', function ($routes) {
$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
$routes->fallbacks('InflectedRoute');
});
Upvotes: 5