![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/Ecombricks/Inventory/Framework/Url/ |
<?php /** * Copyright © eComBricks. All rights reserved. * See LICENSE.txt for license details. */ namespace Ecombricks\Inventory\Framework\Url; /** * URL source trait */ trait SourceTrait { /** * Route params resolver * * @var \Magento\Framework\Url\RouteParamsResolverInterface */ protected $routeParamsResolver; /** * Before get URL * * @param string|null $routePath * @param array|null $routeParams * @return array */ public function inventoryBeforeGetUrl($routePath, $routeParams) { $sourceCode = $this->getSourceCode(); if ($routeParams === null) { $routeParams = []; } if (!$sourceCode || isset($routeParams['source']) || isset($routeParams['_exclude_source'])) { return $routeParams; } if (!isset($this->inventoryParameterActionPathPatterns)) { $routeParams['_exclude_source'] = true; return $routeParams; } $actionPathPatterns = (array) $this->inventoryParameterActionPathPatterns; $this->_setRoutePath($routePath); $actionPath = $this->_getActionPath(); $isAppendSourceParameter = false; foreach ($actionPathPatterns as $actionPathPattern) { if (!$actionPathPattern) { continue; } if (preg_match(trim($actionPathPattern), $actionPath)) { $isAppendSourceParameter = true; break; } } if (!$isAppendSourceParameter) { $routeParams['_exclude_source'] = true; } return $routeParams; } /** * Get route params resolver * * @return Magento\Framework\Url\RouteParamsResolverInterface */ protected function getRouteParamsResolver() { if (!$this->routeParamsResolver) { $this->routeParamsResolver = $this->routeParamsResolverFactory->create(); } return $this->routeParamsResolver; } }