@@ -136,9 +136,9 @@ class Filter extends \Magento\Framework\Filter\Template
136136 protected $ _appState ;
137137
138138 /**
139- * @var \Magento\Backend\Model \UrlInterface
139+ * @var \Magento\Framework \UrlInterface
140140 */
141- protected $ backendUrlBuilder ;
141+ protected $ urlModel ;
142142
143143 /**
144144 * @var \Pelago\Emogrifier
@@ -156,7 +156,7 @@ class Filter extends \Magento\Framework\Filter\Template
156156 * @param \Magento\Framework\View\LayoutInterface $layout
157157 * @param \Magento\Framework\View\LayoutFactory $layoutFactory
158158 * @param \Magento\Framework\App\State $appState
159- * @param \Magento\Backend\Model\ UrlInterface $backendUrlBuilder
159+ * @param \Magento\Framework\ UrlInterface $urlModel
160160 * @param \Pelago\Emogrifier $emogrifier
161161 * @param array $variables
162162 *
@@ -173,7 +173,7 @@ public function __construct(
173173 \Magento \Framework \View \LayoutInterface $ layout ,
174174 \Magento \Framework \View \LayoutFactory $ layoutFactory ,
175175 \Magento \Framework \App \State $ appState ,
176- \Magento \Backend \ Model \ UrlInterface $ backendUrlBuilder ,
176+ \Magento \Framework \ UrlInterface $ urlModel ,
177177 \Pelago \Emogrifier $ emogrifier ,
178178 $ variables = []
179179 ) {
@@ -187,7 +187,7 @@ public function __construct(
187187 $ this ->_layout = $ layout ;
188188 $ this ->_layoutFactory = $ layoutFactory ;
189189 $ this ->_appState = $ appState ;
190- $ this ->backendUrlBuilder = $ backendUrlBuilder ;
190+ $ this ->urlModel = $ urlModel ;
191191 $ this ->emogrifier = $ emogrifier ;
192192 parent ::__construct ($ string , $ variables );
193193 }
@@ -495,22 +495,19 @@ public function storeDirective($construction)
495495 unset($ params ['url ' ]);
496496 }
497497
498- return $ this ->getUrl ($ path , $ params );
498+ return $ this ->urlModel -> getUrl ($ path , $ params );
499499 }
500500
501501 /**
502- * @param string $path
503- * @param array $params
504- * @return string
502+ * Set current URL model, which will be used for URLs generation.
503+ *
504+ * @param \Magento\Framework\UrlInterface $urlModel
505+ * @return $this
505506 */
506- protected function getUrl ( $ path , $ params )
507+ public function setUrlModel ( \ Magento \ Framework \ UrlInterface $ urlModel )
507508 {
508- $ isBackendStore = \Magento \Store \Model \Store::DEFAULT_STORE_ID === $ this ->getStoreId ()
509- || \Magento \Store \Model \Store::ADMIN_CODE === $ this ->getStoreId ();
510-
511- return $ isBackendStore
512- ? $ this ->backendUrlBuilder ->getUrl ($ path , $ params )
513- : $ this ->_storeManager ->getStore ($ this ->getStoreId ())->getUrl ($ path , $ params );
509+ $ this ->urlModel = $ urlModel ;
510+ return $ this ;
514511 }
515512
516513 /**
0 commit comments