claroline / Claroline

Learning management system
https://www.claroline.com
Other
315 stars 188 forks source link

Plugin route configuration #689

Closed ChMat closed 9 years ago

ChMat commented 9 years ago

Hi,

I'm working on a plugin. The routes defined for each controller action are all prefixed by default with the plug-in bundle short name : e.g. /chmatmypluginname/action_route.

I could not find a way to override this behaviour. And I don't want that prefix.

Thanks for your help!

ngodfraind commented 9 years ago

Hello,

This is easy to solve.

Add this method in your bundle class file (the one wich is name looks like "_MyVendorMyBundle_Bundle"

public function getConfiguration($environment)
{
    $config = new ConfigurationBuilder();

    return $config->addRoutingResource(__DIR__ . '/Resources/config/routing.yml', null, 'myprefix');
}

Don't forget to add use Claroline\KernelBundle\Bundle\ConfigurationBuilder; at the beginning of the class.