Skip to content

Commit

Permalink
https://github.com/solutionforest/Filament-SimpleLightBox/issues/9
Browse files Browse the repository at this point in the history
  • Loading branch information
lam0819 committed May 9, 2024
1 parent 372e4c6 commit 15b23c8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/SimpleLightBoxPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,37 @@ 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(array_merge($extraAttributes, ['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')']))
->openUrlInNewTab()
->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
->openUrlInNewTab()
->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(array_merge($extraAttributes, ['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')']));
return $this
->openUrlInNewTab()
->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(array_merge($extraAttributes, ['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')']));
return $this
->openUrlInNewTab()
->extraAttributes(array_merge($extraAttributes,['x-on:click' => 'SimpleLightBox.open(event, \'' . $url . '\')']));
});

}
Expand Down

0 comments on commit 15b23c8

Please sign in to comment.