From 2c9b25fdfdfbc50f9c7ee959108e9149b0c46e1c Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Thu, 13 Sep 2018 10:07:29 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#686 where FieldtypeCheckbox::markupValue() result ended up blank after a PHP strip_tags() --- wire/modules/Fieldtype/FieldtypeCheckbox.module | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wire/modules/Fieldtype/FieldtypeCheckbox.module b/wire/modules/Fieldtype/FieldtypeCheckbox.module index 91144d86..b7bc2e54 100644 --- a/wire/modules/Fieldtype/FieldtypeCheckbox.module +++ b/wire/modules/Fieldtype/FieldtypeCheckbox.module @@ -35,10 +35,13 @@ class FieldtypeCheckbox extends Fieldtype { public function ___markupValue(Page $page, Field $field, $value = null, $property = '') { if(is_null($value)) $value = $page->get($field->name); $checked = $value ? " checked='checked'" : ""; - return ""; + $textValue = $value ? '☒': '☐'; // utf-8 checkbox (the ☑ is also works for checked, but not quite as visible) + // note: the span below ensures a value survives even if markupValue has tags stripped from it + return "$textValue"; } public function getInputfield(Page $page, Field $field) { + /** @var InputfieldCheckbox $inputfield */ $inputfield = $this->modules->get('InputfieldCheckbox'); $inputfield->set('checkedValue', 1); $inputfield->set('uncheckedValue', 0);