Issue with plugin referencing theme function

Hello.

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?

Thanks for your advice.

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.

Thanks for your reply, John.

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.

I’m puzzled…

This error is occurring on the admin side only?

The themes are generally not ever loaded on the admin side, so the problem you’re describing is kind of how I would have always expected it to behave.

I see what you mean.
Still, for some reason, before the update it was working fine (wrongly, I suppose, but fine). I’ve inherited the situation, so I’ll need to fix the issue in a more permanent way.

Just for the sake of curiosity, could it be that some extra check has been introduced, and that has restricted the domain of the function?

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.

That’s quite a good guess. I’ll check that, it seems Reclaim is performing a backup before upgrading software so I might be able to find the solution. Thanks for your advice.

This topic was automatically closed after 250 days. New replies are no longer allowed.