Skip to content

Commit

Permalink
skip routes.yaml for extension
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzmg authored Oct 25, 2024
1 parent 01fd80f commit c40993e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/dev/getting-started/extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,29 @@ somevendor.contao_example_bundle.controller:
type: attribute
```

If you only need one format (e.g. `attribute`) and have all your controllers in the same place (e.g. `src/Controller`),
you may save yourself the additional config file:

```php
// src/ContaoManager/Plugin.php
namespace Somevendor\ContaoExampleBundle\ContaoManager;
use Contao\ManagerPlugin\Routing\RoutingPluginInterface;
use Symfony\Component\Config\Loader\LoaderResolverInterface;
use Symfony\Component\HttpKernel\KernelInterface;
class Plugin implements RoutingPluginInterface
{
public function getRouteCollection(LoaderResolverInterface $resolver, KernelInterface $kernel)
{
return $resolver
->resolve(__DIR__.'/../Controller', 'attribute')
->load(__DIR__.'/../Controller')
;
}
}
```


## Versioning & Publishing

Expand Down

0 comments on commit c40993e

Please sign in to comment.