Redefining routes in a plugin

The default routing for a plugin looks like this:

I would like to redefine routes for this plugin and be able to do simply:

I understand Omeka has a define_routes hook, but the documentation doesn't show any actual examples and I really can't figure out how to achieve the above setup.

I'll be very grateful if somebody could help me out with this.

The forum is not letting me edit, but what I meant of course is: how to turn:


The relevant documentation about how routes work would come from Zend, we use the Zend Framework router.

You'd probably want to use the "standard" route class, Zend_Controller_Router_Route, and from what you've said your route should be something like plugin/:paramname. In the defaults array, you'd set the keys module, controller, and action to (going from your example URL) plugin, controller, and action.

Thanks a lot, John.

I still don't understand though where in the plugin would I be doing all of the above?

Are you looking at the current version of the documentation? (it's over here at Read the Docs)

I think it gives a pretty reasonable example. What's there is just pulled straight out of the Simple Pages plugin, so it's probably a little more complicated than what you actually need. you probably just need the $router->addRoute call.

Yes, that did the trick. Many thanks, again.

Worth noting is that "is_admin" in the example doesn't work in omeka 2.3 and should probably be replaced by "is_admin_theme".