Skip to content

Commit c1fe894

Browse files
committed
feat: add method to retrieve theme by code
1 parent b9c8e85 commit c1fe894

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/Model/ThemeList.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,15 @@ public function getAllThemes(): array
2727
{
2828
return $this->magentoThemeList->getItems();
2929
}
30+
31+
public function getThemeByCode(string $code): ?\Magento\Framework\View\Design\ThemeInterface
32+
{
33+
$themes = $this->getAllThemes();
34+
foreach ($themes as $theme) {
35+
if ($theme->getCode() === $code) {
36+
return $theme;
37+
}
38+
}
39+
return null;
40+
}
3041
}

0 commit comments

Comments
 (0)