Routing ======= The default routes used in the CRUD controller are accessible through the ``Admin`` class. The ``Admin`` class contains two routing methods: * ``getRoutes()``: Returns the available routes; * ``generateUrl($name, $options)``: Generates the related routes. Routing Definition ------------------ You can set a ``baseRouteName`` property inside your ``Admin`` class, which represents the route prefix. .. code-block:: php List List Create a route -------------- You can easily register new routes by defining them in the ``Admin`` class. Only Admin routes should be registered this way. Of course this requires the related action to be defined in the controller. As route is always generated with the ``Admin`` context, it can only be defined by its name. .. code-block:: php add('duplicate'); $collection->add('view', $this->getRouterIdParameter().'/view'); } } Persistent parameters --------------------- In some cases, the interface might be required to pass the same parameters across the different ``Admin``'s actions. Instead of setting them in the template or doing other weird hacks, you can define a ``getPersistentParameters`` method. This method will be used when a link is being generated. .. code-block:: php getRequest()) { return array(); } return array( 'provider' => $this->getRequest()->get('provider'), 'context' => $this->getRequest()->get('context', 'default'), ); } } // the result : // $admin->generateUrl('create') => /admin/module/create?context=default