I have a content type that allows users to make their own tags, for me to be able to properly search through these tags I need them to be in a specific format.

Rather than burden users with my strict formatting guideline I would like to just alter the input to my format before creating the tag. Is such a thing possible?

  • 1
    Could you explain what you mean by 'format'? – ratface Nov 7 '15 at 20:43
  • the format is a single tag with all ingredients for instance, a food recipe may call for apples bacon and sugar, the format I would need is apple-bacon-sugar – Telix Nov 7 '15 at 21:10

Implement hook_taxonomy_term_presave in a custom module and alter the terms according using PHP's string manipulation functions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.