Adding a New Output Format to Exhibit Builder?

I'd like to add a new output format to Exhibit Builder and am curious to know how difficult (or easy) it would be. I've tried to follow along with this guide:

But my PHP skills are basic. Ideally I'd like to add the txt format (simple, right?) so that I can access it on other pages via an AJAX modal window.

What has confused me are the variables $controller and $context (show?). What should they be, if this is possible?

Again, thank you for your help!

In that example, you're writing a callback function, so it's designed to be called automatically by another part of the Omeka code.

$context and $controller are passed in for you. You don't define them, they're just available for your function to use. As the example shows, you can test $controller to see what controller is currently executing, and you add your new context (output format) to $context.

So, your code using those filters would look very much like the example, except where it uses 'browse', you would have 'show', and where it mentions the ItemsController, you'd want to use ExhibitBuilder_ExhibitsController.