Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Module.php
Go to the documentation of this file.
1 <?php
8 
11 
15 class Module
16 {
20  private $assetRepo;
21 
25  public function __construct(Asset\Repository $assetRepo)
26  {
27  $this->assetRepo = $assetRepo;
28  }
29 
41  public function convertModuleNotationToPath(Asset\LocalInterface $thisAsset, $relatedFileId)
42  {
43  if (false === strpos($relatedFileId, Asset\Repository::FILE_ID_SEPARATOR)) {
44  return $relatedFileId;
45  }
46  $thisPath = $thisAsset->getPath();
47  $relatedAsset = $this->assetRepo->createSimilar($relatedFileId, $thisAsset);
48  $relatedPath = $relatedAsset->getPath();
49  $offset = FileSystem::offsetPath($relatedPath, $thisPath);
50  return FileSystem::normalizePath($offset . '/' . basename($relatedPath));
51  }
52 }
__construct(Asset\Repository $assetRepo)
Definition: Module.php:25
convertModuleNotationToPath(Asset\LocalInterface $thisAsset, $relatedFileId)
Definition: Module.php:41
static offsetPath($relatedPath, $path)
Definition: FileSystem.php:209