Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigPathResolver.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
18  private $scopeCodeResolver;
19 
23  public function __construct(ScopeCodeResolver $scopeCodeResolver)
24  {
25  $this->scopeCodeResolver = $scopeCodeResolver;
26  }
27 
44  public function resolve($path, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null, $type = null)
45  {
46  $path = trim($path, '/');
47  $scope = rtrim($scope, 's');
48 
50  if (in_array($scope, [ScopeInterface::SCOPE_STORE, ScopeInterface::SCOPE_WEBSITE])) {
51  $scope .= 's';
52  }
53 
54  $scopePath = $type ? $type . '/' . $scope : $scope;
55 
57  if (is_numeric($scopeCode) || $scopeCode === null) {
58  $scopeCode = $this->scopeCodeResolver->resolve($scope, $scopeCode);
59  }
60 
61  $scopePath .= '/' . $scopeCode;
62  }
63 
64  return $scopePath . ($path ? '/' . $path : '');
65  }
66 }
__construct(ScopeCodeResolver $scopeCodeResolver)
$type
Definition: item.phtml:13
resolve($path, $scope=ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode=null, $type=null)