Skip to content

Commit 8df5f27

Browse files
committed
Merge branch 'main' of github.com:backstagephp/uploadcare-field into feat/media-optimizations
2 parents 3982bbd + 224ffec commit 8df5f27

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

.github/workflows/fix-php-code-style-issues.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ jobs:
2323
uses: aglipanci/laravel-pint-action@2.6
2424

2525
- name: Commit changes
26-
uses: stefanzweifel/git-auto-commit-action@v6
26+
uses: stefanzweifel/git-auto-commit-action@v7
2727
with:
28-
commit_message: Fix styling
28+
commit_message: "fix: styling"

.github/workflows/update-changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
release-notes: ${{ github.event.release.body }}
2626

2727
- name: Commit updated CHANGELOG
28-
uses: stefanzweifel/git-auto-commit-action@v6
28+
uses: stefanzweifel/git-auto-commit-action@v7
2929
with:
3030
branch: main
3131
commit_message: Update CHANGELOG

src/Uploadcare.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Filament\Actions\Action;
1212
use Filament\Facades\Filament;
1313
use Filament\Forms\Components\Select;
14+
use Filament\Forms\Components\TextInput;
1415
use Filament\Forms\Components\Toggle;
1516
use Filament\Schemas\Components\Grid;
1617
use Filament\Schemas\Components\Tabs;
@@ -29,6 +30,8 @@ public static function getDefaultConfig(): array
2930
'multiple' => false,
3031
'imagesOnly' => false,
3132
'withMetadata' => true,
33+
'cropPreset' => '',
34+
'acceptedFileTypes' => null,
3235
];
3336
}
3437

@@ -81,7 +84,12 @@ public static function make(string $name, Field $field): Input
8184
$input = $input->label($field->name ?? self::getDefaultConfig()['label'] ?? null)
8285
->uploaderStyle(Style::tryFrom($field->config['uploaderStyle'] ?? null) ?? Style::tryFrom(self::getDefaultConfig()['uploaderStyle']))
8386
->multiple($field->config['multiple'] ?? self::getDefaultConfig()['multiple'])
84-
->withMetadata($field->config['withMetadata'] ?? self::getDefaultConfig()['withMetadata']);
87+
->withMetadata($field->config['withMetadata'] ?? self::getDefaultConfig()['withMetadata'])
88+
->cropPreset($field->config['cropPreset'] ?? self::getDefaultConfig()['cropPreset']);
89+
90+
if ($field->config['acceptedFileTypes'] ?? self::getDefaultConfig()['acceptedFileTypes']) {
91+
$input->acceptedFileTypes(explode(',', $field->config['acceptedFileTypes']));
92+
}
8593

8694
if ($field->config['imagesOnly'] ?? self::getDefaultConfig()['imagesOnly']) {
8795
$input->imagesOnly();
@@ -127,6 +135,21 @@ public function getForm(): array
127135
Style::REGULAR->value => __('Regular'),
128136
])
129137
->required(),
138+
TextInput::make('config.cropPreset')
139+
->label(__('Crop preset'))
140+
->placeholder(__('e.g., "free, 1:1, 16:9" or leave empty to disable'))
141+
->helperText(__('Comma-separated aspect ratios (e.g., "free, 1:1, 16:9, 4:3") or empty to disable cropping'))
142+
->columnSpanFull(),
143+
Select::make('config.acceptedFileTypes')
144+
->label(__('Accepted file types'))
145+
->options([
146+
'image/*' => __('Image'),
147+
'video/*' => __('Video'),
148+
'audio/*' => __('Audio'),
149+
'application/*' => __('Application'),
150+
])
151+
->multiple()
152+
->columnSpanFull(),
130153
]),
131154
]),
132155
])->columnSpanFull(),

0 commit comments

Comments
 (0)