I’ve just noticed a problem with a site I’m working on. The site is hosted on Reclaim, and they automatically upgraded to newest Omeka release (3.0.1), so as the issue was not there before I suppose the new release has triggered it.
The plugin (a customized version of Collection Tree) is referencing a custom theme function. As said, before things were working fine, while now we get a “Uncaught Error: Call to undefined function …” error.
What could cause the problem, and what could it be the best course of action? Should I reference the theme’s function page in the plugin, or replicate the same function in the plugin itself, or what?
I guess I’d need to know a little more about what’s happening to make a good recommendation.
I’m surprised that going to Omeka 3.0.1 would affect this… it’s not simply the case that the custom theme was an update of a core theme and the updated copy was overwritten with a fresh one during the upgrade, is it? That would make some sense.
If this is being used in a view, the best course of action might be to override the Collection Tree view in your theme to use the theme-specific function, so that both the function and its use live only in the theme.
The theme is a forked version of Berlin theme, but it has a different name and sits in a different folder, so it was not automatically overwritten during the upgrade. I’ve checked the theme, and the function page and that specific function are still there; even more, I can confirm they are working fine on public side, while they do not on admin side.
If I copy the function inside the plugin file that is calling it (views/helpers/CollectionTreeList.php), of course, the issue disappears.
The basic answer is that the themes don’t get loaded on the admin side, so their custom defined functions don’t get loaded either. This hasn’t changed in forever.
I’m a little stumped as to how this could have been working for you previously… perhaps the custom function in the theme was just also defined somewhere in an edit to the Omeka core, possibly the admin theme, and that edited file was replaced in the automatic upgrade process.