Skip to content

Commit

Permalink
add filament-plugins integration
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Sep 16, 2024
1 parent 4d2cabf commit f395471
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
29 changes: 29 additions & 0 deletions module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "FilamentMediaManager",
"alias": "filament-media-manager",
"description": {
"ar": "قم بادارة ملفات الوسائط الخاصة بك باستخدام مكتبة الوسائط من spatie بواجهة رسومية سهلة الاستخدام لـ FilamentPHP",
"en": "Manage your media files using spatie media library with easy to use GUI for FilamentPHP",
"gr": "Manage your media files using spatie media library with easy to use GUI for FilamentPHP",
"sp": "Manage your media files using spatie media library with easy to use GUI for FilamentPHP"
},
"keywords": [],
"priority": 0,
"providers": [
"TomatoPHP\\FilamentMediaManager\\FilamentMediaManagerServiceProvider"
],
"files": [],
"title": {
"ar": "مدير الوسائط",
"en": "Media Manager",
"gr": "Media Manager",
"sp": "Media Manager"
},
"color": "#cc1448",
"icon": "heroicon-c-photo",
"placeholder": "https://raw.githubusercontent.com/tomatophp/filament-media-manager/master/arts/3x1io-tomato-media-manager.jpg",
"type": "plugin",
"version": "v1.1.2",
"github" : "https://github.com/tomatophp/filament-media-manager",
"docs" : "https://github.com/tomatophp/filament-media-manager"
}
23 changes: 19 additions & 4 deletions src/FilamentMediaManagerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Filament\Contracts\Plugin;
use Filament\Panel;
use Nwidart\Modules\Module;
use TomatoPHP\FilamentArtisan\Pages\Artisan;
use TomatoPHP\FilamentMediaManager\Pages\FoldersPage;
use TomatoPHP\FilamentMediaManager\Resources\FolderResource;
Expand All @@ -12,6 +13,9 @@

class FilamentMediaManagerPlugin implements Plugin
{
private bool $isActive = false;


public ?bool $allowSubFolders = false;
public ?bool $allowUserAccess = false;

Expand All @@ -34,10 +38,21 @@ public function allowUserAccess(bool $condation = true): static

public function register(Panel $panel): void
{
$panel->resources([
FolderResource::class,
MediaResource::class
]);
if(class_exists(Module::class)){
if(\Nwidart\Modules\Facades\Module::find('FilamentMediaManager')->isEnabled()){
$this->isActive = true;
}
}
else {
$this->isActive = true;
}

if($this->isActive) {
$panel->resources([
FolderResource::class,
MediaResource::class
]);
}

}

Expand Down

0 comments on commit f395471

Please sign in to comment.