Skip to content

Kh/dev/brand aware templates - #21

Merged
bromiesTM merged 2 commits into
masterfrom
kh/dev/brand-aware-templates
Mar 16, 2026
Merged

Kh/dev/brand aware templates#21
bromiesTM merged 2 commits into
masterfrom
kh/dev/brand-aware-templates

Conversation

@bromiesTM

Copy link
Copy Markdown
Contributor

No description provided.

@bromiesTM
bromiesTM force-pushed the kh/dev/brand-aware-templates branch 2 times, most recently from f90fbc2 to 5e6970e Compare March 6, 2026 13:02
@bromiesTM
bromiesTM requested a review from Copilot March 6, 2026 13:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds brand-aware email templates and assets by introducing a BrandResolver that selects template fragments/images based on the ncw.brand system config, with fallback to the default ionos brand.

Changes:

  • Introduces BrandResolver to resolve brand-specific template paths and image names with sanitization and fallback.
  • Updates EMailTemplate to load templates and generate asset URLs using BrandResolver.
  • Adds IONOS-branded template fragments and image assets, plus unit tests covering brand resolution and updated template behavior.

Reviewed changes

Copilot reviewed 6 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/BrandResolver.php New resolver for brand selection + fallback for templates and images.
lib/EMailTemplate.php Uses BrandResolver for template loading and asset URL generation.
lib/templates/email/head.html Legacy template file modified (currently contains placeholder content).
lib/templates/email/ionos/head.html Adds brand-scoped head fragment.
lib/templates/email/ionos/header.html Adds brand-scoped header fragment.
lib/templates/email/ionos/heading.html Adds brand-scoped heading fragment.
lib/templates/email/ionos/bodyBegin.html Adds brand-scoped bodyBegin fragment.
lib/templates/email/ionos/bodyText.html Adds brand-scoped bodyText fragment.
lib/templates/email/ionos/listBegin.html Adds brand-scoped listBegin fragment.
lib/templates/email/ionos/listItem.html Adds brand-scoped listItem fragment.
lib/templates/email/ionos/listEnd.html Adds brand-scoped listEnd fragment.
lib/templates/email/ionos/buttonGroup.html Adds brand-scoped buttonGroup fragment.
lib/templates/email/ionos/button.html Adds brand-scoped button fragment.
lib/templates/email/ionos/bodyEnd.html Adds brand-scoped bodyEnd fragment.
lib/templates/email/ionos/footer.html Adds brand-scoped footer fragment.
lib/templates/email/ionos/tail.html Adds brand-scoped tail fragment.
img/ionos/spacer.png Adds default brand spacer image.
img/ionos/logo.png Adds default brand logo image.
img/ionos/email.png Adds default brand email icon image.
img/ionos/list-item-icon.png Adds default brand list item icon image.
tests/unit/BrandResolverTest.php New unit tests for brand sanitization and per-file fallback behavior.
tests/lib/EMailTemplateTest.php Updates tests for new brand-scoped template/image paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/templates/email/head.html Outdated
Comment thread tests/unit/BrandResolverTest.php Outdated
Comment on lines +21 to 24
$originalContent = file_exists($templateFile) ? file_get_contents($templateFile) : null;
$expectedContent = '<div>Test Head Template</div>';
file_put_contents($templateFile, $expectedContent);

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test mutates a tracked template file via file_put_contents(), but the restoration logic is not protected by try/finally. If an assertion fails or an exception occurs before cleanup, the file remains modified and can break other tests; wrap the write/assertions in a try/finally (or use a temp copy) to guarantee restoration.

Copilot uses AI. Check for mistakes.
@printminion-co

Copy link
Copy Markdown
Contributor

@copilot open a new pull request to apply changes based on the comments in this thread

Copilot AI commented Mar 10, 2026

Copy link
Copy Markdown

@printminion-co I've opened a new pull request, #22, to work on those changes. Once the pull request is ready, I'll request review from you.

@printminion-co printminion-co left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review done... ..lets also add the IONOSCLOUD email-foo here. Otherwise we will no emails if BRAND!=IONOS

observe fixup commits I've aded on top

bromiesTM and others added 2 commits March 16, 2026 09:22
…olution

Signed-off-by: Kai Henseler <kai.henseler@strato.de>
Add ionoscloud brand assets for NSW-689:
- img/ionoscloud/logo.png: IONOS Cloud white logo (for dark blue header)
- ionoscloud/header.html: logo alt/title updated to "IONOS Cloud Logo"
- ionoscloud/bodyEnd.html: greeting signature changed from "IONOS SE" to "IONOS Cloud"
- ionoscloud/footer.html: address block changed from "IONOS SE" to "IONOS Cloud"

All other templates and images fall back to the ionos brand via BrandResolver.
Activate with system config: 'ncw.brand' => 'ionoscloud'
@bromiesTM
bromiesTM force-pushed the kh/dev/brand-aware-templates branch from 58d1dd3 to 911878c Compare March 16, 2026 08:22
@bromiesTM
bromiesTM merged commit f70c8dd into master Mar 16, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants