Custom search function - Studio-42/elFinder GitHub Wiki
About adding custom search function
In elFinder 2.1.38 or later, you can add custom search functions such as searching from content metadata.
Setting client options
Add the definition of the custom search method to the client option.
opts = {
url : 'php/connector.php',
commandsOptions : {
search : {
// Additional search types
searchTypes : {
// "SearchMime" is implemented in default
SearchMime : { // The key is search type that send to the connector
name : 'btnMime', // Button text to be processed in i18n()
title : 'searchMime' // Button title to be processed in i18n()
},
// This is custom search method for a function `searchMatchContents()` of your customized volume driver
Contents : {
name : 'MetaData',
title : 'Do serach contents of meta data.'
}
}
}
}
}
Add function to volume driver
Add search matching method searchMatchContents()
to your customized volume driver.
This function must return true
or false
as to whether or not it matches the condition.
protected function searchMatchContents($name, $query, $path) {
$match = true; // or false
return $match;
}