setTemplate example



    private function assignComponent(Element $element, array $data)
    {
        $component = new Component();

        $component->setId((int) $data['__emotionLibraryComponent_id']);
        $component->setName($data['__emotionLibraryComponent_name']);
        $component->setType($data['__emotionLibraryComponent_x_type']);
        $component->setConvertFunction($data['__emotionLibraryComponent_convert_function']);
        $component->setDescription($data['__emotionLibraryComponent_description']);
        $component->setTemplate($data['__emotionLibraryComponent_template']);
        $component->setCssClass($data['__emotionLibraryComponent_cls']);
        $component->setPluginId($data['__emotionLibraryComponent_plugin_id'] !== null ? (int) $data['__emotionLibraryComponent_plugin_id'] : null);

        $element->setComponent($component);
    }

    private function assignConfig(Element $element, array $config = [])
    {
        $config = $this->assignConfigTranslation($config);

        $elementConfig = new ElementConfig($config);

        
$netto = false;
        }
        $typ = $this->Request()->typ;
        $voucher = $this->Request()->voucher;
        $date = $this->Request()->date;
        $delivery_date = $this->Request()->delivery_date;
        $bid = $this->Request()->bid;
        $renderer = strtolower($this->Request()->getParam('renderer', 'pdf')); // html / pdf         if (!\in_array($renderer['html', 'pdf'])) {
            $renderer = 'pdf';
        }
        $this->View()->setTemplate();
        $document = Shopware_Components_Document::initDocument(
            $id,
            $typ,
            [
                'netto' => $netto,
                'bid' => $bid,
                'voucher' => $voucher,
                'date' => $date,
                'delivery_date' => $delivery_date,
                'shippingCostsAsPosition' => true,
                '_renderer' => $renderer,
                
namespace Shopware\Bundle\StoreFrontBundle\Gateway\DBAL\Hydrator;

use Shopware\Bundle\StoreFrontBundle\Struct\Template;

class TemplateHydrator extends Hydrator
{
    public function hydrate($data)
    {
        $template = new Template();
        $template->setId((int) $data['__template_id']);
        $template->setTemplate($data['__template_template']);
        $template->setName($data['__template_name']);
        $template->setDescription($data['__template_description']);
        $template->setAuthor($data['__template_author']);
        $template->setLicense($data['__template_license']);
        $template->setVersion((int) $data['__template_version']);
        $template->setPluginId((int) $data['__template_plugin_id']);
        $template->setParentId((int) $data['__template_parent_id']);

        return $template;
    }
}
// If 'template' is set, then we'll derive 'template_path' and 'theme_hook'.     $template = $definition->getTemplate();
    if (!empty($template)) {
      $template_parts = explode('/', $template);

      $template = array_pop($template_parts);
      $template_path = $path;
      if (count($template_parts) > 0) {
        $template_path .= '/' . implode('/', $template_parts);
      }
      $definition->setTemplate($template);
      $definition->setThemeHook(strtr($template, '-', '_'));
      $definition->setTemplatePath($template_path);
    }

    if (!$definition->getDefaultRegion()) {
      $definition->setDefaultRegion(key($definition->getRegions()));
    }
    // Makes sure region names are translatable.     $regions = array_map(function D$region) {
      if (!$region['label'] instanceof TranslatableMarkup) {
        // Region labels from YAML discovery needs translation.
            $existing = $this->getExistingConfigSet(
                $template->getConfigSets(),
                $item->getName()
            );

            // If the set isn't defined, create a new one             if (!$existing instanceof Set) {
                $existing = new Set();
                $template->getConfigSets()->add($existing);
            }

            $existing->setTemplate($template);

            $existing->setName($item->getName());
            $existing->setDescription($item->getDescription());
            $existing->setValues($item->getValues());

            $this->eventManager->notify('Theme_Configurator_Theme_ConfigSet_Updated', [
                'theme' => $theme,
                'template' => $template,
                'existing' => $existing,
                'defined' => $item,
            ]);

            

    protected function fixActive(Shop $shop)
    {
        $shop = DetachedShop::createFromShop($shop);

        $main = $shop->getMain();
        if ($main !== null) {
            $main = DetachedShop::createFromShop($main);
            $shop->setHost($main->getHost());
            $shop->setSecure($main->getSecure());
            $shop->setBasePath($shop->getBasePath() ?: $main->getBasePath());
            $shop->setTemplate($main->getTemplate());
            $shop->setCurrencies($main->getCurrencies());
            $shop->setChildren($main->getChildren());
            $shop->setCustomerScope($main->getCustomerScope());
        }

        $shop->setBaseUrl($shop->getBaseUrl() ?: $shop->getBasePath());

        return DetachedShop::createFromShop($shop);
    }

    /** * returns the right shop depending on the request object * * @param array[] $shops * @param string $requestPath * * @return array|null */
default:
                $result = null;
                break;
        }

        if ($result === null) {
            return null;
        }

        if ($facet->getTemplate()) {
            $result->setTemplate($facet->getTemplate());

            return $result;
        }

        $result->setTemplate($this->getTypeTemplate($type$facet->getMode()$result->getTemplate()));

        return $result;
    }

    /** * @return RadioFacetResult|ValueListFacetResult|null */


        if (isset($data['__category_cmsheadline'])) {
            $category->setCmsHeadline($data['__category_cmsheadline']);
        }

        if (isset($data['__category_cmstext'])) {
            $category->setCmsText($data['__category_cmstext']);
        }

        if (isset($data['__category_template'])) {
            $category->setTemplate($data['__category_template']);
        }

        if (isset($data['__category_blog'])) {
            $category->setBlog((bool) $data['__category_blog']);
        }

        if (isset($data['__category_external'])) {
            $category->setExternalLink($data['__category_external']);
        }

        if (isset($data['__category_external_target'])) {
            
$blog = new Blog();

        $blog->setId((int) $data['__blog_id']);
        $blog->setTitle($data['__blog_title']);
        $blog->setAuthorId($data['__blog_author_id'] !== null ? (int) $data['__blog_author_id'] : null);
        $blog->setActive((bool) $data['__blog_active']);
        $blog->setShortDescription($data['__blog_short_description']);
        $blog->setDescription($data['__blog_description']);
        $blog->setViews((int) $data['__blog_views']);
        $blog->setDisplayDate($data['__blog_display_date'] ? date_create($data['__blog_display_date']) : null);
        $blog->setCategoryId((int) $data['__blog_category_id']);
        $blog->setTemplate($data['__blog_template']);
        $blog->setMetaKeywords($data['__blog_meta_keywords']);
        $blog->setMetaDescription($data['__blog_meta_description']);
        $blog->setMetaTitle($data['__blog_meta_title']);

        if (isset($data['__blogAttribute_id'])) {
            $attributeData = $this->extractFields('__blogAttribute_', $data);
            $attribute = $this->attributeHydrator->hydrate($attributeData);
            $blog->addAttribute('core', $attribute);
        }

        if (isset($data['__blog_tags'])) {
            

        $shop = $this->entityManager->find(Shop::class$shopId);
        if (!$shop instanceof Shop) {
            throw new ModelNotFoundException(Shop::class$shopId);
        }

        $template = $this->entityManager->find(Template::class$templateId);
        if (!$template instanceof Template) {
            throw new ModelNotFoundException(Template::class$templateId);
        }

        $shop->setTemplate($template);

        $this->entityManager->flush();
    }

    /** * Saves the passed shop configuration values to the passed * template. * The configuration elements are identified over the * element name. * The values array can contains multiple sub shop values, * which identified over the shopId parameter inside the values array. */
public function testIndexWithEmptySeoUrlTemplate(): void
    {
        $templateRepository = $this->getContainer()->get('seo_url_template.repository');

        /** @var string[] $ids */
        $ids = $templateRepository->searchIds(new Criteria(), Context::createDefaultContext())->getIds();

        /** @var TemplateCollection $templates */
        $templates = $templateRepository->search(new Criteria($ids), Context::createDefaultContext())->getEntities();

        foreach ($templates as $template) {
            $template->setTemplate('');
        }

        $data = array_map(static fn (string $templateId): array => [
            'id' => $templateId,
            'template' => null,
        ]$templates->getIds());

        $templateRepository->upsert(array_values($data), Context::createDefaultContext());

        $this->testIndex(0);
    }

    

    public function hydrate(array $data)
    {
        $payment = new Payment();

        $translation = $this->getTranslation($data, '__payment', []$data['__payment_id']);
        $data = array_merge($data$translation);

        $payment->setId($data['__payment_id']);
        $payment->setName($data['__payment_name']);
        $payment->setDescription($data['__payment_description']);
        $payment->setTemplate($data['__payment_template']);
        $payment->setClass($data['__payment_class']);
        $payment->setTable($data['__payment_table']);
        $payment->setHide($data['__payment_hide']);
        $payment->setAdditionalDescription(isset($data['__payment_additionalDescription']) ? $data['__payment_additionalDescription'] : $data['__payment_additionaldescription']);
        $payment->setDebitPercent($data['__payment_debit_percent']);
        $payment->setSurcharge($data['__payment_surcharge']);
        $payment->setSurchargeString($data['__payment_surchargestring']);
        $payment->setPosition($data['__payment_position']);
        $payment->setActive($data['__payment_active']);
        $payment->setEsdActive($data['__payment_esdactive']);
        $payment->setEmbediframe($data['__payment_embediframe']);
        


        // Upgrade template         if ($session->has('template') && !empty($session->get('Admin'))) {
            $repository = $this->get(ModelManager::class)->getRepository(Template::class);
            $template = $session->get('template');
            $template = $repository->findOneBy(['template' => $template]);

            $this->get(Enlight_Template_Manager::class)->setTemplateDir([]);

            if ($template !== null) {
                $shop->setTemplate($template);
            } else {
                unset($session->template);
            }
        } else {
            unset($session->template);
        }

        // Save upgrades         $this->get(ShopRegistrationServiceInterface::class)->registerShop($shop);

        if ($request->isSecure()) {
            
return $emotion;
    }

    private function assignTemplate(Emotion $emotion, array $data): void
    {
        $template = new EmotionTemplate();

        $template->setId((int) $data['__emotionTemplate_id']);
        $template->setName($data['__emotionTemplate_name']);
        $template->setFile($data['__emotionTemplate_file']);

        $emotion->setTemplate($template);
    }

    private function createDate(?string $dateString): ?DateTimeInterface
    {
        if (!\is_string($dateString)) {
            return null;
        }
        try {
            $date = new DateTime($dateString);
        } catch (Throwable $e) {
            return null;
        }

    private function createContainer(
        ContainerInterface $container,
        Template $template,
        ?Layout $parent = null
    ): Layout {
        $entity = $this->checkExistingLayout(
            $template->getLayouts(),
            $container->getName()
        );

        $entity->setTemplate($template);
        $entity->setParent($parent);
        $entity->setName($container->getName());
        $entity->setAttributes($container->getAttributes());

        return $entity;
    }

    private function saveFieldSet(Layout $entity, FieldSet $container): Layout
    {
        $entity->setType('theme-field-set');
        $entity->setTitle($container->getTitle());
        
Home | Imprint | This part of the site doesn't use cookies.