Skip to content

Conversation

@Tomasz-Silpion
Copy link
Member

@Tomasz-Silpion Tomasz-Silpion commented Dec 16, 2025

Description (*)

Add possibility to rewrite getDefaultTemplatesAsOptionsArray method

Related Pull Requests

  • see OpenMage/magento-lts#<issue_number>

Fixed Issues (if relevant)

  • fixes OpenMage/magento-lts#<issue_number>

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)

Copilot AI review requested due to automatic review settings December 16, 2025 00:27
@github-actions github-actions bot added the Component: Adminhtml Relates to Mage_Adminhtml label Dec 16, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds return type declarations and improves the extensibility of admin email preview templates by changing how default templates are retrieved.

  • Added return type declaration (: array) to getTemplateOptions() method
  • Modified template retrieval to use model instance instead of static call, allowing method override in custom modules

public function getTemplateOptions(): array
{
return Mage_Core_Model_Email_Template::getDefaultTemplatesAsOptionsArray();
return Mage::getModel('core/email_template')->getDefaultTemplatesAsOptionsArray();
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

Creating a new model instance on every call to getTemplateOptions() is inefficient. Consider instantiating the model once and reusing it, or caching the result if the templates don't change frequently during a request.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

Test Results

966 tests  ±0   958 ✅ ±0   16s ⏱️ ±0s
213 suites ±0     8 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 5e8dd00. ± Comparison against base commit b74526a.

♻️ This comment has been updated with latest results.

@sreichel
Copy link
Contributor

sreichel commented Dec 18, 2025

Please add description.

Not possible to rewrite getDefaultTemplatesAsOptionsArray?

Pls do not change signature for public methods.

@Tomasz-Silpion Tomasz-Silpion changed the title Add return type and allow to override admin email preview templates Allow to override admin email preview templates Dec 18, 2025
@sreichel
Copy link
Contributor

getTemplateOptions and getDefaultTemplatesAsOptionsArray are public methods.

Why not rewrite them?

P----------lease add some descrition what it is for.

@sreichel sreichel marked this pull request as draft December 20, 2025 14:09
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants