| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\App\Modules\StorageDrivers\Local; |
| 4 |
|
| 5 |
use FluentCart\App\Services\FileSystem\Drivers\Local\LocalDriver; |
| 6 |
use FluentCart\App\Vite; |
| 7 |
use FluentCart\App\Modules\StorageDrivers\BaseStorageDriver; |
| 8 |
|
| 9 |
class Local extends BaseStorageDriver |
| 10 |
{ |
| 11 |
/** |
| 12 |
* title, slug, brandColor |
| 13 |
*/ |
| 14 |
public function __construct() |
| 15 |
{ |
| 16 |
parent::__construct( |
| 17 |
__('Local', 'fluent-cart'), |
| 18 |
'local', |
| 19 |
'#136196' |
| 20 |
); |
| 21 |
} |
| 22 |
|
| 23 |
public function registerHooks() |
| 24 |
{ |
| 25 |
// |
| 26 |
} |
| 27 |
|
| 28 |
public function getLogo(): string |
| 29 |
{ |
| 30 |
return Vite::getAssetUrl("images/storage-drivers/local.svg"); |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
public function getDescription(): string |
| 35 |
{ |
| 36 |
return esc_html__('Local allows to upload file in local file storage', 'fluent-cart'); |
| 37 |
} |
| 38 |
|
| 39 |
public function isEnabled(): bool |
| 40 |
{ |
| 41 |
return (new LocalSettings())->isActive(); |
| 42 |
} |
| 43 |
|
| 44 |
public function getSettings() |
| 45 |
{ |
| 46 |
return (new LocalSettings())->get(); |
| 47 |
} |
| 48 |
|
| 49 |
public function fields(): array |
| 50 |
{ |
| 51 |
return [ |
| 52 |
'view' => [ |
| 53 |
'title' => __('Local Settings', 'fluent-cart'), |
| 54 |
'type' => 'section', |
| 55 |
'disable_nesting' => true, |
| 56 |
'columns' => [ |
| 57 |
'default' => 1, |
| 58 |
'md' => 1, |
| 59 |
'lg' => 1 |
| 60 |
], |
| 61 |
'schema' => [ |
| 62 |
'is_active' => [ |
| 63 |
'value' => '', |
| 64 |
'label' => __('Enable local driver', 'fluent-cart'), |
| 65 |
'type' => 'checkbox' |
| 66 |
] |
| 67 |
] |
| 68 |
] |
| 69 |
]; |
| 70 |
} |
| 71 |
|
| 72 |
public function getDriverClass(): string |
| 73 |
{ |
| 74 |
return LocalDriver::class; |
| 75 |
} |
| 76 |
|
| 77 |
public function hiddenSettingKeys(): array |
| 78 |
{ |
| 79 |
return []; |
| 80 |
} |
| 81 |
} |
| 82 |
|