forked from Kunstmaan/KunstmaanBundlesCMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KUN-8979 | (feat) search media in subfolders
- Loading branch information
1 parent
a44ead7
commit 56e0462
Showing
11 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/Kunstmaan/MediaBundle/AdminList/FilterType/SubFolderFilterType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kunstmaan\MediaBundle\AdminList\FilterType; | ||
|
||
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\AbstractORMFilterType; | ||
use Kunstmaan\MediaBundle\Entity\Folder; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
class SubFolderFilterType extends AbstractORMFilterType | ||
{ | ||
public function __construct( | ||
private Folder $folder, | ||
string $columnName | ||
) { | ||
parent::__construct($columnName); | ||
} | ||
|
||
public function bindRequest(Request $request, array &$data, $uniqueId): void | ||
{ | ||
$data['value'] = $request->query->get('filter_value_' . $uniqueId); | ||
} | ||
|
||
public function apply(array $data, $uniqueId): void | ||
{ | ||
if (!isset($data['value']) || $data['value'] !== 'true') { | ||
return; | ||
} | ||
|
||
$folders = $this->folder->fetchChildIds(); | ||
$folders[] = $this->folder->getId(); | ||
|
||
$this->queryBuilder->setParameter('folders', $folders); | ||
} | ||
|
||
public function getTemplate(): string | ||
{ | ||
return '@KunstmaanAdminList/FilterType/booleanFilter.html.twig'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters