38 private $readDirFactory;
43 private $themePackages;
54 \
Magento\Framework\Module\Dir\Reader $moduleReader,
59 $this->_dataStorage = $dataStorage;
60 $this->_moduleReader = $moduleReader;
62 $this->themePackages = $themePackages;
63 $this->readDirFactory = $readDirFactory;
74 foreach (array_keys($this->_dataStorage->get()) as
$templateId) {
81 $templates = array_merge($templates, $themeTemplates);
100 foreach ($this->themePackages->getThemes() as
$theme) {
101 if (
$theme->getArea() == $area) {
102 $themeDir = $this->readDirFactory->create(
$theme->getPath());
103 $file =
"$module/email/$filename";
104 if ($themeDir->isExist($file)) {
139 $pattern =
"#^(?<templateId>[^/]+)/(?<themeVendor>[^/]+)/(?<themeName>[^/]+)#i";
141 $parts[
'templateId'] = $matches[
'templateId'];
142 $parts[
'theme'] = $matches[
'themeVendor'] .
'/' . $matches[
'themeName'];
201 if (!isset($designParams[
'area'])) {
205 $designParams[
'module'] = $module;
208 $filename = $this->getFilename($file, $designParams, $module);
223 $data = $this->_dataStorage->get();
225 throw new \UnexpectedValueException(
"Email template '{$templateId}' is not defined.");
228 throw new \UnexpectedValueException(
229 "Field '{$fieldName}' is not defined for email template '{$templateId}'." 246 private function getFilename(
string $file, array $designParams,
string $module): string
248 $filename = $this->viewFileSystem->getEmailTemplateFileName($file, $designParams, $module);
250 if ($filename ===
false) {
251 throw new \UnexpectedValueException(
"Template file '{$file}' is not found.");
getTemplateLabel($templateId)
getTemplateFilename($templateId, $designParams=[])
getThemeTemplates($templateId)
getTemplateArea($templateId)
getTemplateType($templateId)
parseTemplateIdParts($templateId)
_getInfo($templateId, $fieldName)
__construct(\Magento\Email\Model\Template\Config\Data $dataStorage, \Magento\Framework\Module\Dir\Reader $moduleReader, \Magento\Framework\View\FileSystem $viewFileSystem, ThemePackageList $themePackages, ReadFactory $readDirFactory)
getTemplateModule($templateId)