45 \
Magento\Cms\Helper\Wysiwyg\Images $cmsWysiwygImages,
48 \
Magento\Framework\Serialize\Serializer\Json $serializer =
null 51 $this->_cmsWysiwygImages = $cmsWysiwygImages;
53 ->get(\
Magento\Framework\Serialize\Serializer\Json::class);
54 parent::__construct($context,
$data);
64 $storageRoot = $this->_cmsWysiwygImages->getStorageRoot();
68 $this->_cmsWysiwygImages->getCurrentPath()
73 'text' => $this->_cmsWysiwygImages->getShortFilename(
$item->getBasename(), 20),
74 'id' => $this->_cmsWysiwygImages->convertPathToId(
$item->getFilename()),
75 'path' => substr(
$item->getFilename(), strlen($storageRoot)),
79 $hasNestedDirectories = count(glob(
$item->getFilename() .
'/*', GLOB_ONLYDIR)) > 0;
82 if (!$hasNestedDirectories) {
83 $data[
'state'] =
'leaf';
88 return $this->serializer->serialize($jsonArray);
100 $currentTreePath = $this->
getRequest()->getParam(
'current_tree_path');
102 if (strlen($currentTreePath)) {
103 $params[
'current_tree_path'] = $currentTreePath;
119 return __(
'Storage Root');
129 $treePath = [
'root'];
131 if ($idEncodedPath = $this->
getRequest()->getParam(
'current_tree_path')) {
132 $path = $this->_cmsWysiwygImages->idDecode($idEncodedPath);
134 $path = $this->_coreRegistry->registry(
'storage')->getSession()->getCurrentPath();
138 $path = str_replace($this->_cmsWysiwygImages->getStorageRoot(),
'',
$path);
140 foreach (explode(
'/',
$path) as $dirName) {
142 $relative[] = $dirName;
143 $treePath[] = $this->_cmsWysiwygImages->idEncode(implode(
'/', $relative));
getUrl($route='', $params=[])
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
__construct(\Magento\Backend\Block\Template\Context $context, \Magento\Cms\Helper\Wysiwyg\Images $cmsWysiwygImages, \Magento\Framework\Registry $registry, array $data=[], \Magento\Framework\Serialize\Serializer\Json $serializer=null)