diff --git a/wire/modules/Fieldtype/FieldtypeCheckbox.module b/wire/modules/Fieldtype/FieldtypeCheckbox.module
index c4631b1b..1022010a 100644
--- a/wire/modules/Fieldtype/FieldtypeCheckbox.module
+++ b/wire/modules/Fieldtype/FieldtypeCheckbox.module
@@ -8,7 +8,7 @@
* For documentation about the fields used in this class, please see:
* /wire/core/Fieldtype.php
*
- * ProcessWire 3.x, Copyright 2020 by Ryan Cramer
+ * ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
*/
@@ -56,15 +56,22 @@ class FieldtypeCheckbox extends Fieldtype {
* @param Field $field
* @param int|null $value
* @param string $property
- * @return MarkupFieldtype|string
+ * @return string
*
*/
public function ___markupValue(Page $page, Field $field, $value = null, $property = '') {
if(is_null($value)) $value = $page->get($field->name);
$checked = $value ? " checked='checked'" : "";
- $textValue = $value ? '☒': '☐'; // utf-8 checkbox (the ☑ is also works for checked, but not quite as visible)
+ if($this->wire()->page->template->name === 'admin') {
+ // use fa-icon for checkbox in the admin
+ $out = $checked ? wireIconMarkup('check-square-o') : wireIconMarkup('square-o');
+ } else {
+ // use disabled checkbox outside of the admin
+ $out = "";
+ }
// note: the span below ensures a value survives even if markupValue has tags stripped from it
- return "$textValue";
+ $textValue = $checked ? '☒' : '☐'; // utf-8 checkbox (the ☑ also works for checked, but not quite as visible)
+ return $out . "$textValue";
}
/**
@@ -148,7 +155,6 @@ class FieldtypeCheckbox extends Fieldtype {
*
*/
public function ___getCompatibleFieldtypes(Field $field) {
- if($field) {}
$fieldtypes = $this->wire(new Fieldtypes());
$toggleClass = 'FieldtypeToggle';
$allowToggle = $this->wire()->modules->isInstalled($toggleClass);
@@ -165,4 +171,3 @@ class FieldtypeCheckbox extends Fieldtype {
}
}
-