coreRegistry = $coreRegistry; $this->templatesFactory = $templatesFactory; $this->emailConfig = $emailConfig; } /** * Generate list of email templates * * @return array */ public function toOptionArray() { /** @var $collection \Magento\Email\Model\ResourceModel\Template\Collection */ if (!($collection = $this->coreRegistry->registry('config_system_email_template'))) { $collection = $this->templatesFactory->create(); $collection->load(); $this->coreRegistry->register('config_system_email_template', $collection); } return $this->emailConfig->getAvailableTemplates(); } }