File tree Expand file tree Collapse file tree 2 files changed +20
-12
lines changed Expand file tree Collapse file tree 2 files changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,5 @@ enum Badge: string
77 case INLINE = 'inline ' ;
88 case BOTTOMLEFT = 'bottomleft ' ;
99 case BOTTOMRIGHT = 'bottomright ' ;
10-
11- // TODO
12- // case HIDDEN = 'hidden';
10+ case HIDDEN = 'hidden ' ;
1311}
Original file line number Diff line number Diff line change @@ -57,22 +57,32 @@ private function getJsTokenScript(): string
5757 JS ;
5858 }
5959
60+ private function getHiddenBadgeStyle (): string
61+ {
62+ return <<<'CSS'
63+ .grecaptcha-badge {
64+ visibility: hidden;
65+ }
66+ CSS;
67+ }
68+
6069 private function toHtml (Badge $ badge ): string
6170 {
6271 if (! Config::isEnabled ()) {
6372 return '' ;
6473 }
6574
66- return implode ( "\n\n" , [
75+ $ parts = [
6776 str ($ this ->getJsScriptUrl ($ badge ))->wrap ('<script> ' , '</script> ' ),
6877 str ($ this ->getJsTokenScript ())->wrap ('<script> ' , '</script> ' ),
69- // TODO: add style
70- ]);
71- }
78+ ];
7279
73- // <style>
74- // .grecaptcha-badge {
75- // bottom: 90px !important;
76- // }
77- // </style>
80+ return collect ($ parts )
81+ ->when ($ badge === Badge::HIDDEN , fn ($ collection ) => (
82+ $ collection ->push (str (
83+ $ this ->getHiddenBadgeStyle ()
84+ )->wrap ('<style> ' , '</style> ' ))
85+ ))
86+ ->implode ("\n\n" );
87+ }
7888}
You can’t perform that action at this time.
0 commit comments