@@ -39,13 +39,16 @@ public function boot(Panel $panel): void
39
39
return $ url ;
40
40
};
41
41
42
- ImageColumn::macro ('simpleLightbox ' , macro: function ($ url = null ) use ($ ensureLightBoxUrl ) {
42
+ ImageColumn::macro ('simpleLightbox ' , macro: function ($ url = null , $ urlAsDefault = true ) use ($ ensureLightBoxUrl ) {
43
43
44
44
$ url = $ ensureLightBoxUrl ($ url , $ this );
45
45
46
46
$ extraAttributes = $ this ->extraAttributes [0 ] ?? [];
47
47
$ extraImgAttributes = $ this ->extraImgAttributes [0 ] ?? [];
48
48
49
+ if ($ urlAsDefault ) {
50
+ $ this ->defaultImageUrl ($ url );
51
+ }
49
52
/** @phpstan-ignore-next-line */
50
53
return $ this
51
54
->openUrlInNewTab ()
@@ -54,37 +57,50 @@ public function boot(Panel $panel): void
54
57
->extraImgAttributes (array_merge ($ extraImgAttributes , ['class ' => 'simple-light-box-img-indicator ' ]));
55
58
});
56
59
57
- ImageEntry::macro ('simpleLightbox ' , function ($ url = null ) use ($ ensureLightBoxUrl ) {
60
+
61
+ ImageEntry::macro ('simpleLightbox ' , function ($ url = null , $ urlAsDefault = true ) use ($ ensureLightBoxUrl ) {
58
62
59
63
$ url = $ ensureLightBoxUrl ($ url , $ this );
60
64
61
65
$ extraAttributes = $ this ->extraAttributes [0 ] ?? [];
62
66
$ extraImgAttributes = $ this ->extraImgAttributes [0 ] ?? [];
63
67
68
+ if ($ urlAsDefault ) {
69
+ $ this ->defaultImageUrl ($ url );
70
+ }
71
+
64
72
/** @phpstan-ignore-next-line */
65
73
return $ this
66
74
->openUrlInNewTab ()
67
75
->extraAttributes (array_merge ($ extraAttributes , ['x-on:click ' => 'SimpleLightBox.open(event, \'' . $ url . '\') ' ]))
68
76
->extraImgAttributes (array_merge ($ extraImgAttributes , ['class ' => 'simple-light-box-img-indicator ' ]));
69
77
});
70
78
71
- TextColumn::macro ('simpleLightbox ' , function ($ url = null ) use ($ ensureLightBoxUrl ) {
79
+ TextColumn::macro ('simpleLightbox ' , function ($ url = null , $ urlAsDefault = true ) use ($ ensureLightBoxUrl ) {
72
80
73
81
$ url = $ ensureLightBoxUrl ($ url , $ this );
74
82
75
83
$ extraAttributes = $ this ->extraAttributes [0 ] ?? [];
76
84
85
+ if ($ urlAsDefault ) {
86
+ $ this ->default ($ url );
87
+ }
88
+
77
89
/** @phpstan-ignore-next-line */
78
90
return $ this
79
91
->openUrlInNewTab ()
80
92
->url ($ url )
81
93
->extraAttributes (array_merge ($ extraAttributes , ['x-on:click ' => 'SimpleLightBox.open(event, \'' . $ url . '\') ' ]));
82
94
});
83
95
84
- TextEntry::macro ('simpleLightbox ' , function ($ url = null ) {
96
+ TextEntry::macro ('simpleLightbox ' , function ($ url = null , $ urlAsDefault = true ) {
85
97
86
98
$ extraAttributes = $ this ->extraAttributes [0 ] ?? [];
87
99
100
+ if ($ urlAsDefault ) {
101
+ $ this ->default ($ url );
102
+ }
103
+
88
104
/** @phpstan-ignore-next-line */
89
105
return $ this
90
106
->openUrlInNewTab ()
0 commit comments