File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ protected function defineAdminPage(): void
101101 ->docs ('https://docs.simpleanalytics.com/bypass-ad-blockers ' );
102102
103103 $ tab ->checkbox (SettingName::ENABLED , 'Enabled ' )
104+ ->default (true )
104105 ->description ('Enable or disable Simple Analytics on your website. ' );
105106 })
106107 ->tab ('Ignore Rules ' , function (Tab $ tab ) {
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ class Checkbox extends Field
1010{
1111 use HasDocs;
1212
13+ protected bool $ default = false ;
14+
1315 public function getValueSanitizer (): callable
1416 {
1517 return 'absint ' ;
@@ -20,6 +22,13 @@ public function getValueType(): string
2022 return 'integer ' ;
2123 }
2224
25+ public function default (bool $ value ): self
26+ {
27+ $ this ->default = $ value ;
28+
29+ return $ this ;
30+ }
31+
2332 public function render (): void
2433 {
2534 ?>
@@ -36,7 +45,7 @@ public function render(): void
3645 value="1"
3746 class="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
3847 <?php
39- if (Setting::get ($ this ->getKey ()) ) echo 'checked ' ;
48+ if (Setting::boolean ($ this ->getKey (), $ this -> default ) === true ) echo 'checked ' ;
4049 ?>
4150 >
4251 </div>
You can’t perform that action at this time.
0 commit comments