Skip to content

Commit

Permalink
add notice
Browse files Browse the repository at this point in the history
  • Loading branch information
mansoorkhan96 committed Oct 19, 2024
1 parent e3f1cef commit e2a7675
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@ Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-unsplash-picker-views"
```

> [!IMPORTANT]
> When defining the `extraAlpineAttributes` method for `SpatieMediaLibraryFileUpload` or `FileUpload` field, make sure to merge the Alpine attributes from `UnsplashPickerAction`.
```php
SpatieMediaLibraryFileUpload::make('media')
->extraAlpineAttributes(function ($component) {
return [
'custom-attribute' => 'custom-attribute-value-goes-here',
...UnsplashPickerAction::getExtraAlpineAttributes($component),
];
})
```

## Upgrade to 1.x

This plugin is re-written but it is very small and simple, so upgrade is very easy. If you follow the docs from top to bottom, you should be good to use the latest version.
Expand Down
8 changes: 7 additions & 1 deletion src/UnsplashPickerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace Mansoor\UnsplashPicker;

use BladeUI\Icons\Factory;
use Filament\Forms\Components\BaseFileUpload;
use Livewire\Livewire;
use Mansoor\UnsplashPicker\Actions\UnsplashPickerAction;
use Mansoor\UnsplashPicker\Livewire\UnsplashPickerComponent;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
Expand All @@ -26,14 +28,18 @@ public function packageRegistered()
{
$this->callAfterResolving(Factory::class, function (Factory $factory) {
$factory->add('up', [
'path' => __DIR__ . '/../resources/icons',
'path' => __DIR__.'/../resources/icons',
'prefix' => 'up',
]);
});
}

public function packageBooted(): void
{
BaseFileUpload::configureUsing(function (BaseFileUpload $component) {
$component->extraAlpineAttributes(UnsplashPickerAction::getExtraAlpineAttributes(...));
});

Livewire::component('unsplash-picker-component', UnsplashPickerComponent::class);
}
}
8 changes: 4 additions & 4 deletions todo.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# TODO

- [ ] DOCS: Add custom theme css instructions
- [ ] DOCS: Add warning & example for using extraAlpineAttributes in FileUpload
- [ ] DOCS: Depricate per_page, use_square_display config
- [ ] Add upgrade guide
- [ ] Write tests
- [ ] Add full pagination support, similar to table pagination
- [ ] Support more providers like pexels, bing images ???
- [x] DOCS: Add warning & example for using extraAlpineAttributes in FileUpload
- [x] Add upgrade guide
- [x] DOCS: Depricate per_page, use_square_display config
- [x] DOCS: Add custom theme css instructions
- [x] Add option to initially pick search keywords from an existing input like title
- [x] Add a method to run after the upload, so that user can also interact with unsplash data
- [x] Allow to pick images based on remaining max upload limit
Expand Down

0 comments on commit e2a7675

Please sign in to comment.