Skip to content

Commit

Permalink
https://github.com/solutionforest/Filament-SimpleLightBox/issues/13
Browse files Browse the repository at this point in the history
  • Loading branch information
lam0819 committed May 9, 2024
1 parent 532f159 commit b00d882
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/SimpleLightBoxPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,33 @@ public function register(Panel $panel): void
public function boot(Panel $panel): void
{
ImageColumn::macro('simpleLightbox', macro: function ($url = null) {
$extraAttributes = $this->extraAttributes[0] ?? [];
$extraImgAttributes = $this->extraImgAttributes[0] ?? [];
/** @phpstan-ignore-next-line */
return $this
->extraAttributes(['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')'])
->extraImgAttributes(['class' => 'simple-light-box-img-indicator']);
->extraAttributes(array_merge($extraAttributes, ['x-on:click' => 'SimpleLightBox.open(event, \''.$url.'\')']))
->extraImgAttributes(array_merge($extraImgAttributes, ['class' => 'simple-light-box-img-indicator']));
});

ImageEntry::macro('simpleLightbox', function ($url = null) {
$extraAttributes = $this->extraAttributes[0] ?? [];
$extraImgAttributes = $this->extraImgAttributes[0] ?? [];
/** @phpstan-ignore-next-line */
return $this
->extraAttributes(['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')'])
->extraImgAttributes(['class' => 'simple-light-box-img-indicator']);
->extraAttributes(array_merge($extraAttributes, ['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')']))
->extraImgAttributes(array_merge($extraImgAttributes, ['class' => 'simple-light-box-img-indicator']));
});

TextColumn::macro('simpleLightbox', function ($url) {
$extraAttributes = $this->extraAttributes[0] ?? [];
/** @phpstan-ignore-next-line */
return $this->extraAttributes(['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')']);
return $this->extraAttributes(array_merge($extraAttributes,['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')']));
});

TextEntry::macro('simpleLightbox', function ($url) {
$extraAttributes = $this->extraAttributes[0] ?? [];
/** @phpstan-ignore-next-line */
return $this->extraAttributes(['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')']);
return $this->extraAttributes(array_merge($extraAttributes,['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')']));
});

}
Expand Down

0 comments on commit b00d882

Please sign in to comment.