routing
Allows to add custom frontend or backend routing rules.
Shop-Script
Input (passed by reference)
$route array Current route parameters.
… your plugin code …
Output
$return
Custom routing rules in the form of an associative array similar to the way default rules are specified in Shop-Script config file routing.php.
To ensure that custom routing rules are used only in the frontend or only in the backend, use the value returned by the wa()->getEnv() method when returning a result by an event handler.
Shop-Script
Plugin code example
PHP
public function routingHandler($route)
{
if (wa()->getEnv() == 'frontend') {
return [
// Requests at the URL matching pattern '[storefront_url]/[plugin_id]/page/'
// must be processed by a class with the name matching pattern `shop[Plugin_id]PluginFrontend[Controller|Action]`.
$this->id . '/page/' => 'frontend/page',
// extended format
// $this->id . '/page/' => [
// 'module' => 'frontend',
// 'action' => 'page',
// ],
];
}
}









