Skip to content

Instantly share code, notes, and snippets.

@dawehner
Created April 22, 2014 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dawehner/11188956 to your computer and use it in GitHub Desktop.
Save dawehner/11188956 to your computer and use it in GitHub Desktop.
class ResourceRoutes extends RouteSubscriberBase{
protected function alterRoutes(RouteCollection $collection) {
$routes = array();
$enabled_resources = $this->config->get('rest.settings')->get('resources') ?: array();
// Iterate over all enabled resource plugins.
foreach ($enabled_resources as $id => $enabled_methods) {
$plugin = $this->manager->getInstance(array('id' => $id));
foreach ($plugin->routes() as $name => $route) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment