Perform controller logic before sending user to their requested route

7 views
Skip to first unread message

Douglas Duhaime

unread,
Sep 2, 2016, 6:33:46 AM9/2/16
to Omeka Dev
This question is related to my last one, but seemed sufficiently more concrete that it warranted a new thread with a new title.

I'm wondering how one could perform some custom controller logic in Omeka before sending a user to the route they requested. For instance, say I want to use local storage to store the last route a user requested within my domain. Each time a user requests a new route within my application, I want to destroy the old key/value pair I stored in their local storage, set a new key/value pair in the localstorage, then send the user to the route they requested (in that order).

How can I perform this kind of pre-route logic in Omeka? Is it possible to tap into some abstract application logic to carry out this work? I'm imagining that I might need to write a meta controller that imports the show methods from the collections controller, items controller, exhibit controller, etc., then in my meta controller I would define the logic to be performed before the show method is called. I would prefer not to go this way if possible, as there are a decent number of routes for which I want to perform work (e.g. the local storage task) before I show the user the view associated with that route. 

If I need to go the way described above, do others know the best way to import the show method from the collections controller (say) in Omeka 2.3.1? Once I know this syntax, I think I can carry out this work. In any event, I'd be grateful for any insights others can offer on this query.


Patrick Murray-John

unread,
Sep 2, 2016, 9:51:00 AM9/2/16
to omek...@googlegroups.com
I'm not 100% sure I'm following exactly what you need, but the ControllerPlugin thing I suggested in the previous response might also be a path for this, depending on whether there is a way to dig up the data you need from there.

Patrick
--
You received this message because you are subscribed to the Google Groups "Omeka Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omeka-dev+...@googlegroups.com.
To post to this group, send email to omek...@googlegroups.com.
Visit this group at https://groups.google.com/group/omeka-dev.
For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages