protected function prepareFilesEditor(array $data)
    {
        $prepared = array();

        foreach ($data as $folder => $files) {
            foreach ($files as $file) {

                $path = trim(str_replace($this->data_module['directory'], '', $file), '/');
                $depth = substr_count(str_replace('\\', '/', $path), '/'); // WIN compatibility

                $pathinfo = pathinfo($path);
                $directory = is_dir($file);
                $parent = $directory ? $path : $pathinfo['dirname'];

                $prepared[$folder][$parent][] = array(
                    'file' => $file,
                    'path' => $path,
                    'depth' => $depth,
                    'directory' => $directory,
                    'name' => $pathinfo['basename'],
                    'id' => gplcart_string_encode($path),
                    'indentation' => str_repeat('<span class="indentation"></span>', $depth)
                );
            }

            ksort($prepared[$folder]);
        }
        return $prepared;
    }