示例#1
0
 /**
  * Return tree node full path based on current path
  *
  * @return string
  */
 public function getTreeCurrentPath()
 {
     $treePath = ['root'];
     if ($path = $this->_coreRegistry->registry('storage')->getSession()->getCurrentPath()) {
         $path = str_replace($this->_cmsWysiwygImages->getStorageRoot(), '', $path);
         $relative = [];
         foreach (explode('/', $path) as $dirName) {
             if ($dirName) {
                 $relative[] = $dirName;
                 $treePath[] = $this->_cmsWysiwygImages->idEncode(implode('/', $relative));
             }
         }
     }
     return $treePath;
 }
示例#2
0
 public function testConvertIdToPathNodeRoot()
 {
     $pathId = \Magento\Theme\Helper\Storage::NODE_ROOT;
     $this->assertEquals($this->imagesHelper->getStorageRoot(), $this->imagesHelper->convertIdToPath($pathId));
 }
示例#3
0
 /**
  * Get path in root storage dir
  *
  * @param string $path
  * @return string|bool
  */
 protected function _getRelativePathToRoot($path)
 {
     return substr($this->_sanitizePath($path), strlen($this->_sanitizePath($this->_cmsWysiwygImages->getStorageRoot())));
 }