mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-12 19:34:31 +02:00
Added a simple autocomplete mechanism for the footprint URL.
This commit is contained in:
parent
4675793c24
commit
3277d98ee2
10 changed files with 180 additions and 6 deletions
|
@ -59,7 +59,7 @@ class BuiltinAttachmentsFinder
|
|||
]);
|
||||
}
|
||||
|
||||
public function find(string $keyword, array $options) : array
|
||||
public function find(string $keyword, array $options = []) : array
|
||||
{
|
||||
$finder = new Finder();
|
||||
|
||||
|
@ -67,9 +67,20 @@ class BuiltinAttachmentsFinder
|
|||
$this->configureOptions($resolver);
|
||||
$options = $resolver->resolve($options);
|
||||
|
||||
if (empty($options['placeholders'])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
//We search only files
|
||||
$finder->files();
|
||||
$finder->in($this->pathResolver->getFootprintsPath());
|
||||
//Add the folder for each placeholder
|
||||
foreach ($options['placeholders'] as $placeholder) {
|
||||
$tmp = $this->pathResolver->placeholderToRealPath($placeholder);
|
||||
//Ignore invalid/deactivated placeholders:
|
||||
if ($tmp !== null) {
|
||||
$finder->in($tmp);
|
||||
}
|
||||
}
|
||||
|
||||
//Apply filter if needed
|
||||
if (!empty($options['filename_filter'])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue