I believe I have a way to do this, but as I'm learning I want to make sure I'm not doing it horribly wrong or reinventing a wheel that already exists (the module search on the Drupal site leaves a lot to be desired).
I've got a Link field with multiple values (just URLs). When this field is being rendered, I would like to sort of preprocess each of the URLs. If it's a youtube or vimeo link, I'd like to change it so that a video embed is rendered instead. If it's a link to an audio file (with certain extensions) then I want to render an html5 audio tag. Else, I just want to render the link normally.
It looks like I could override
mytheme_field__links__mycontenttype() (although I'm not exactly sure how to implement that method just yet, any examples are welcome).
It also looks like I could create a template in my theme named
Is this the right way to go?
Is one better than the other?
Do you have any links to a good example of how to implement/override these?