I’ve faced such a problem with generating links for my module views
While being on a page
I try to create link to
Url::toRoute('permissions') // Result is "/rights-manager-dev/roles/permissions"
Url::toRoute('/permissions') // Result is "/permissions"
Ok. I dived into the \yii\helper\Url code and discovered, that folowing code solves my problem:
Url::toRoute('permissions/') // Result is "/rights-manager-dev/permissions"
This happens because of \yii\helpers\Url::normalizeRoute($route) protected static function.
I attach an image with explanation
Defining route as “permissions/” looks strange to me.
Is it supposed to be so, when using modules? Or am I missing smth?
How should one use \yii\helpers\Url correctly inside a module?