SunMailer first generates the newsletter as XML before using XSL to convert it to HTML or text. In the process of building the XML, SunMailer provides several hooks for developers to add additional content:
- hook_sunmailer_xml_newsletter_alter(DOMElement $newsletterNode, DOMDocument $dom, SunMailerNewsletter $newsletter)
- hook_sunmailer_xml_section_alter(DOMElement $sectionNode, DOMDocument $dom, SunMailerSection $section, array $sectionViewsContent)
- hook_sunmailer_xml_content_alter(DOMElement $contentNode, DOMDocument $dom, array $viewsContent)
Here is a summary of the arguments for the alter hooks:
- For all hooks, the first two arguments are the XML element for the newsletter/section/content as well as the underlying DOM document for the newsletter.
- For the newsletter and section hooks, the third argument is an object containing information about that newsletter/section.
- For the section and content hooks, the last argument is the content itself. The content for the content hook is generated for a node using the Views module. The content for the section hook aggregates each node's content into an array keyed by node ID.
You can look at the code for SunMailerContentBuilder class to get more information on the process of building the newsletter as XML.