1

I am building a custom module to grab data from an XML feed, however some of the data comes in badly formatted and I would like to change some of it around (for example put line breaks after certain words). Where would be the most Drupaly place to put the code that does this? In the module's .inc file? Preprocess it in template.php? Or put it in a field template file?

0

1 Answer 1

1

I would add the necessary reformatting of the badly formatted XML to the input processing of the custom module (the one you're writing).

If that is not an option (e.g. if the client insists that the XML feed is saved verbatim), then I would create a custom filter for this content. Drupal filters do not change the input - it only changes the presentation.

1
  • Yes, it's best to validate data on input, format it on output, e.g preprocess or theme func if needed. Feb 16, 2013 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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