2

I'm working on a module which works as an adapter between Drupal and a framework which sends e-mails.

The framework supports inline image attachments, meaning that those images can be carried in the actual message and displayed in the recipients e-mail client without having to download those images from an external location.

I'm thinking that users of this module would be interested in having their e-mails themed so that they reflect the look and feel of the sending website. This is right now done through an 'email.tpl.php' file which the module requests the theming system to theme e-mails with.

Consider a themer/designer that works on theming e-mails. That person then figures out that it would be a good idea to have an inline image attached in e-mails - say a logo. However, how does the designer (via theme functions) tell the module to include one or more pictures which are required by the theme?

I had hoped that my module could make a hook available which other modules and themes could implement, but it appears that only modules can implent hooks. This, at least, applies when using module_invoke_all().

My question is thus; is there a way to let any theme provide feedback to a module similar to how other modules can interact with each other via hooks?

1 Answer 1

1

If you want to pass data into the module, then you don't want to do it at the theme level. The theme layer should be all about output, not data. Try solving it with a fielded entity, templating through a text field with full HTML filter and adding CSS through another field. Images could then be added with a file field.

1
  • As a beginner, I don't expect myself to give you a definite answer, but I highly recommend you to find a module that does related things to what you want to achieve, and to peek into the code. I have looked much into Colorbox module which provides its own formatters and hooks via '#theme' attribute and corresponding functions. Since Colorbox deals with images, you might find there something useful for you. Apr 29, 2012 at 10:57

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.