-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display different icon for empty folders #1643
Labels
Comments
@marcomarsala This is possible with connector main option e.g. - add CSS class name function setEmptyFolderCssName($cmd, &$result, $args, $elfinder, $volume) {
if ($volume && $volume instanceof elFinderVolumeLocalFileSystem && $result) {
$key = '';
if (! empty($result['files'])) {
$key = 'files';
} else if (! empty($result['tree'])) {
$key = 'tree';
} else if (! empty($result['added'])) {
$key = 'added';
}
if ($key) {
foreach($result[$key] as $i => $file) {
if (isset($file['mime']) && $file['mime'] === 'directory') {
$path = $volume->getPath($file['hash']);
if (($items = scandir($path)) && count($items) === 2) {
$result[$key][$i]['csscls'] = 'elfinder-dir-empty';
}
}
}
}
}
}
$opts = array(
'bind' => array( 'open tree parent mkdir' => array( 'setEmptyFolderCssName' ) ),
'roots' => array(
array(
'driver' => 'LocalFileSystem',
'path' => '/path/to/files/',
'URL' => 'http://localhost/to/files/'
)
)
);
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run(); |
this patch don't work with new elFinder version ? :( |
There is just a typing error in "lbind". $opts = array(
'bind' => array( 'open tree parent mkdir' => array( 'setEmptyFolderCssName' ) ),
'roots' => array(
array(
'driver' => 'LocalFileSystem',
'path' => '/path/to/files/',
'URL' => 'http://localhost/to/files/'
)
)
); |
@lajones89 Thanks! I edited it. 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be useful to have an option to display a different icon for empty folders.
The text was updated successfully, but these errors were encountered: