using after save hook


I am interest to add a an after save form hook in my plugin that will be triggered when I click on save configuration form in Exhibit builder.

TO further explain, next to select theme box in exhibit metadata form there is a configuration button, that take he user to a form with different theme options. I would like to save extra information when the user click on save form in this configuration form.

after-save-form-exhibit will be called only when the user save the exhibit but I was not sure what was the other after save hook I need when user click on the save configuration form!


Sorry how I can move this post to plugins!

The hooks always follow the pattern of the hook name, then the model name in underscored form. So, for example, if the page is saving an ExhibitSection, the hook is after_save_form_exhibit_section. As long as your models are extending Omeka_Record, the same pattern will work for model classes you define.

I moved this thread to the Plugins forum for you, nancymou.

So When I am at theme-config form and press on save changes what hook or filter or function I can use in my plug in to call get theme options function?


I want to say I could not find a models corresponding to this form that extend from Omeka_record?

Or maybe it is not possible.

You're right, there is no record that corresponds to that form, and so there's none of the hooks Patrick mentioned for that specifically.

You've brought this general topic up a few times before. Could you refresh our memory of the bigger picture of what you're trying to do? Maybe there's a way to work around this.

If worst comes to worst, you could use an initialize hook or some other hook that runs on every page, and check there for the module/controller/action that corresponds to saving that form, and then read your data directly from the $_POST (assuming there's data on that form you want to act on).

Thanks John for getting back to me.

I am trying to interact with existed forms that available in Omeka, e.g user form and exhibit builder metadata form, and finally config form. I am new to Zend and MVC model and the way to interact with existing form from my plugin is different than the way I vision it.

What I am trying to do with config form is save some information about what group the exhibit belong to e.g. I thought to save this information into the theme-options field available with each exhibit instead of creating a table in db for this purpose.

So it works perfect every time a user save an exhibit I check in my plugin after save hook and update the theme option with the name of the group if it is not available.

The problem happen if the user decide to visit the config form then the data in the theme options are wiped up by exhibit builder and it reads the new data from the $post. Ofcourse the group name is not available in the post and in config.ini file I do not have a solt for the group name, so it wipes the group name from the theme option. to save the group name to theme option the user has to go back to exhibit meta data page and click on save which will trigger the after save hook.

I guess I have two options now:
either I save the group name at the init hook as you suggest or create a table in db to save the exhibit id and group name and id...ect.

I did that successfully when I want to link each user with group. but I though to use the theme option in exhibit builder to save some time.

if you have a third option please let me know.

I same similar problem when I try to store an image for each exhibit to be displayed next to the exhibit title. I store it in theme options.

I wonder if this something should be added to Exhibit builder plugin in the future since I saw other people trying to add extra data to exhibit builder without a need to update the exhibit builder code and adding any new colums to exhibit builder db tables.


I think a separate table is your best option.

You're likely to run in to even more problems than you've had already by trying to work this into the exhibit theme config, since it really wasn't meant for this purpose.

If you wanted something that does depend on the exhibit theme, it'd make more sense to simply have that as one of the theme's config options, which would automatically be handled by that form.

Thanks John,

today there was a discussion in our group why not I added to config form to our theme.

If I go with this rout how I can dynamically load the dad from db in the config.ini file.

Currently all options in my config form are statically defined in the config.ini in our theme.
But for this I need to read the group names from group table in db.