Instance example

/** * @return Enlight_Template_Manager */
    public function factory(
        Enlight_Event_EventManager $eventManager,
        Enlight_Components_Snippet_Resource $snippetResource,
        EscaperInterface $escaper,
        array $templateConfig,
        array $securityConfig,
        array $backendOptions
    ) {
        $template = Enlight_Class::Instance(Enlight_Template_Manager::class[null, $backendOptions]);
        \assert($template instanceof Enlight_Template_Manager);

        $template->enableSecurity(new Security($template$securityConfig));

        $template->setOptions($templateConfig);
        $template->setEventManager($eventManager);

        $template->registerResource('snippet', $snippetResource);
        /* @phpstan-ignore-next-line is handled by magic method `\Smarty_Internal_TemplateBase::__call` and will set the property `\Smarty::$default_resource_type` */
        $template->setDefaultResourceType('snippet');

        

    public function factory(
        Container $container,
        Enlight_Event_EventManager $eventManager,
        array $options,
        RequestStack $requestStack
    ) {
        /** @var Enlight_Controller_Front $front */
        $front = Enlight_Class::Instance('Enlight_Controller_Front', [$eventManager]);

        $front->setDispatcher($container->get('dispatcher'));

        $front->setRouter($container->get(RouterInterface::class));

        $front->setParams($options);

        $front->setRequestStack($requestStack);

        /** @var Enlight_Plugin_PluginManager $plugins */
        $plugins = $container->get('plugins');

        

    public function initSeoIndexResource()
    {
        $this->Application()->Loader()->registerNamespace(
            'Shopware_Components',
            $this->Path() . 'Components/'
        );

        return Enlight_Class::Instance('Shopware_Components_SeoIndex');
    }

    /** * Registers all required events for the similar shown articles function. */
    protected function subscribeSearchIndexEvents()
    {
        $this->subscribeEvent(
            'Enlight_Controller_Dispatcher_ControllerPath_Backend_SearchIndex',
            'getSearchIndexBackendController'
        );

        

    public function initSimilarShownResource()
    {
        $this->Application()->Loader()->registerNamespace(
            'Shopware_Components',
            $this->Path() . 'Components/'
        );

        $similarShown = Enlight_Class::Instance('Shopware_Components_SimilarShown');
        Shopware()->Container()->set('similarshown', $similarShown);

        return $similarShown;
    }

    /** * Event listener function of the Shopware_Plugins_LastArticles_ResetLastArticles * event. This event is fired after the Shopware_Plugins_LastArticles plugin resets * the s_emarketing_lastarticles data for a validation time. * This listener is used to update the similar shown article data at the same time. */
    


        if (!$loader->loadClass($options['type'])) {
            $transportName = ucfirst(strtolower($options['type']));
            $transportName = 'Zend_Mail_Transport_' . $transportName;
        } else {
            $transportName = $options['type'];
        }
        unset($options['type']$options['charset']);

        if ($transportName === Zend_Mail_Transport_Smtp::class) {
            $transport = Enlight_Class::Instance($transportName[$options['host'] ?? null, $options]);
        } elseif (!empty($options)) {
            $transport = Enlight_Class::Instance($transportName[$options]);
        } else {
            $transport = Enlight_Class::Instance($transportName);
        }
        \assert($transport instanceof Zend_Mail_Transport_Abstract);
        Enlight_Components_Mail::setDefaultTransport($transport);

        if (!isset($options['from']) && !empty($config->Mail)) {
            $options['from'] = ['email' => $config->Mail, 'name' => $config->Shopname];
        }

        

    public static function initDocument($orderID$documentID, array $config = [])
    {
        if (empty($orderID)) {
            $config['_preview'] = true;
        }

        /** @var Shopware_Components_Document $document */
        $document = Enlight_Class::Instance('Shopware_Components_Document');

        $config = Shopware()->Container()->get('events')->filter(
            'Shopware_Models_Order_Document_Filter_Config',
            $config,
            [
                'subject' => $document,
                'orderID' => $orderID,
                'documentID' => $documentID,
            ]
        );

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