Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zed gateway twig related performance fix #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/**
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace Spryker\Zed\Twig\Communication\Plugin\Application;


use Spryker\Service\Container\ContainerInterface;
use Twig\Environment;

class ZedGatewayTwigApplicationPlugin extends TwigApplicationPlugin
Nidhognit marked this conversation as resolved.
Show resolved Hide resolved
{
protected const PLUGIN_TO_IGNORE = 'Spryker\Zed\ZedNavigation\Communication\Plugin\Twig\ZedNavigationTwigPlugin';

/**
* @param \Twig\Environment $twig
* @param \Spryker\Service\Container\ContainerInterface $container
*
* @return \Twig\Environment
*/
protected function extendTwig(Environment $twig, ContainerInterface $container): Environment
{
$twigPlugins = $this->getFactory()->getTwigPlugins();
foreach ($twigPlugins as $twigPlugin) {
if ($twigPlugin::class === self::PLUGIN_TO_IGNORE) {
continue;
}

$twig = $twigPlugin->extend($twig, $container);
}

return $twig;
}
}