Which identifier to use with view.layout

I’m trying to inject through the view.layout event, but I’m not sure which identifiers to use. I tried the controllers that I thought were likely, but I was only able to see any results when I used "*" . I’d like to be able to discriminate between omeka admin layouts and theme layouts.

The identifiers for controllers don’t include the trailing “Controller” at the end, which may be tripping you up: they’re “Omeka\Controller\Site\Item” and the like.

You can also use the wildcard identifier and still tell the difference between admin and site views: you can use the “Omeka\Status” service, which lets you check that easily:

if ($this->getServiceLocator()->get('Omeka\Status')->isSiteRequest()) {
    // ...
}

Thanks! Yeah, I was using the controller factory/invokable names from module.config file. I just ran a few other tests and it looks like, for some reason, the JavaScript I was injecting ran when I was using the wildcard, but not when I used 'Omeka\Controller\Site\Index' as the identifier, but in both cases the listener was passing everything to the event. So, I’m guessing it was probably an execution timing issue or some other bug with my script.

The ‘Omeka\Status’ tip is a great help! Many thanks.

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