* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Core\Form\ChoiceProvider; use PrestaShop\PrestaShop\Core\Addon\Theme\Theme; use PrestaShop\PrestaShop\Core\Addon\Theme\ThemeCollection; use PrestaShop\PrestaShop\Core\Form\FormChoiceProviderInterface; /** * Class ThemeByNameChoiceProvider provides theme choices with name values. */ final class ThemeByNameChoiceProvider implements FormChoiceProviderInterface { /** * @var ThemeCollection collection of themes */ private $themeCollection; /** * @param ThemeCollection $themeCollection */ public function __construct(ThemeCollection $themeCollection) { $this->themeCollection = $themeCollection; } /** * {@inheritdoc} */ public function getChoices() { $themeChoices = []; /** @var Theme $theme */ foreach ($this->themeCollection as $theme) { $themeChoices[$theme->getName()] = $theme->getName(); } return $themeChoices; } }