Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

FragmentListenerFactory.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishCoreBundle\Fragment;
8
9 use eZ\Publish\Core\MVC\Symfony\RequestStackAware;
10 use Symfony\Component\HttpKernel\UriSigner;
11
16 class FragmentListenerFactory
17 {
18 use RequestStackAware;
19
20 public function buildFragmentListener(UriSigner $uriSigner, $fragmentPath, $fragmentListenerClass)
21 {
22 // no request when executing over CLI
23 if (!$request = $this->getCurrentRequest()) {
24 return null;
25 }
26
27 // Ensure that current pathinfo ends with configured fragment path.
28 // If so, consider it as the fragment path.
29 // This ensures to have URI siteaccess compatible fragment paths.
30 $pathInfo = $request->getPathInfo();
31 if (substr($pathInfo, -strlen($fragmentPath)) === $fragmentPath) {
32 $fragmentPath = $pathInfo;
33 }
34
35 return new $fragmentListenerClass($uriSigner, $fragmentPath);
36 }
37 }
eZ\Bundle\EzPublishCoreBundle\Fragment\FragmentListenerFactory
Custom factory for Symfony FragmentListener.
Definition: FragmentListenerFactory.php:17
eZ\Bundle\EzPublishCoreBundle\Fragment\FragmentListenerFactory\buildFragmentListener
buildFragmentListener(UriSigner $uriSigner, $fragmentPath, $fragmentListenerClass)
Definition: FragmentListenerFactory.php:20
eZ\Bundle\EzPublishCoreBundle\Fragment
Definition: DecoratedFragmentRenderer.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.