I have route zfcadmin/news. I added route categories as child route to zfcadmin/news. Now I can get this route by zfcadmin/news/categories in views:
$this->url('zfcadmin/news/categories', array('action'=>'add'));
Is it possible to get route by its own name? i.e categories in my case:
$this->url('categories', array('action'=>'add'));
I need this, because 2nd variant is more relative. Using url like in 1st snippet will cause dependency of module, with view with such url usage, to module, where zfcadmin/news route defined.
Is it possible to get route by its name, but not parent_parent/parent/child, where child is name of route, I want to get?
You cannot get the child route by its "relative" name ("categories"), because ZF2 doesn't support that. You always have to provide its "absolute" name ("zfcadmin/news/categories").
If you don't need the dependency, than you should create a controller in your own module and add a route for that controller in your own module's
module.config.phpfile.