Check metadata field exists


When attempting to display a field that does’t exist an error is shown: There is no element "Element Set", "Field"!.

Is there a way of checking a field exists before attempting to display it so I can avoid the error gracefully?


I ended up wrapping the call to metadata in a try so it’ll just fail silently (returning nothing on catch).

If there is a better (more ‘Omeka’) way of doing this I’d be interested to hear it.

Right now that’s pretty much it.

Omeka 2.5 will add a new option for the metadata function called ignore_unknown that makes metadata not throw an exception when the element you give to it doesn’t exist.