translateTheme example

/** @var Template[] $templates */
        $templates = $repository->findAll();

        $result = [];
        foreach ($templates as $template) {
            $data = [
                'id' => $template->getId(),
                'name' => $template->getName(),
                'template' => $template->getTemplate(),
            ];

            $data = $this->get(Service::class)->translateTheme(
                $template,
                $data
            );

            $result[] = $data;
        }

        $this->View()->assign(['success' => true, 'data' => $result]);
    }

    public function getCurrenciesAction()
    {
foreach ($data['data'] as &$theme) {
            $instance = $this->getRepository()->find($theme['id']);
            if (!$instance instanceof Template) {
                continue;
            }

            $theme['screen'] = $this->container->get(Util::class)->getPreviewImage($instance);

            $theme['path'] = $this->container->get(PathResolver::class)->getDirectory($instance);

            $theme = $this->get(Service::class)->translateTheme($instance$theme);

            if ($shop instanceof Shop && $shop->getTemplate() instanceof Template) {
                $theme['enabled'] = $theme['id'] === $shop->getTemplate()->getId();
            }
        }

        return $this->get('events')->filter('Shopware_Theme_Listing_Loaded', $data[
            'shop' => $shop,
        ]);
    }

    
Home | Imprint | This part of the site doesn't use cookies.