This is the D8 port of #1852116: Backport from D8: Customizable "true"/"false" Views output for booleans. The actual feature request is described in that issue in #3:

Rather than introducing yet more settings, what it really should have is a custom setting and then you can fill in the true/false values as you like. With states/dependency it should be pretty easy to make those settings appear only if custom is chosen, and it should be also easy to switch correctly during render.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Les Lim’s picture

Status: Active » Needs review
FileSize
2.69 KB

Patch attached.

tim.plunkett’s picture

Issue tags: +Needs tests, +VDC

Thanks for the patch! We should add test coverage for this.

damiankloip’s picture

Yeah, looks like a pretty good idea, Tim's right, we need tests for this too. Also, it would be good if The custom functionality was turned on/off with a checkbox too maybe?

damiankloip’s picture

Sorry, you have this dependent on the custom format being selected. Awesome! I'll write some tests now.

damiankloip’s picture

FileSize
6.84 KB

Here are some tests to go with your patch, also, I changed the check_plain, to filter_xss_admin... Is it possible people will want tags? Should we even let them?

Les Lim’s picture

FileSize
4.15 KB

Thanks! filter_xss_admin makes sense to me, and appears to be what's used in analogous places in Views.

Here's just the tests from #5.

damiankloip’s picture

I don't think we need just the tests, they will always fail because this is testing new functionality that only exists in the patch above but not expose anything broken :)

Les Lim’s picture

Oh, I thought we also tested to make sure that the tests fail. Carry on, then.

damiankloip’s picture

It's cool, imo we generally add just the tests to expose a current bug, they are there no, so there is no harm in that I guess :)

Status: Needs review » Needs work

The last submitted patch, 1869124-5-tests_only.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review

Setting this back top needs review as the patch in #5 is fine, not #6.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/Boolean.phpundefined
@@ -81,7 +104,10 @@ function render($values) {
diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldBooleanTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldBooleanTest.php

+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldBooleanTest.phpundefined
@@ -84,7 +84,6 @@ public function testFieldBoolean() {
-

Seems to be out of scope but sure that's okay ;)

tim.plunkett’s picture

Issue tags: -Needs tests, -VDC

#5: 1869124-5.patch queued for re-testing.

dawehner’s picture

#5: 1869124-5.patch queued for re-testing.

catch’s picture

tim.plunkett’s picture

#5: 1869124-5.patch queued for re-testing.

dawehner’s picture

#6: 1869124-5-tests_only.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 1869124-5-tests_only.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review

#6: 1869124-5-tests_only.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Needs tests, +VDC

The last submitted patch, 1869124-5-tests_only.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
FileSize
6.87 KB

Rerolled.

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

This should be back to RTBC.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.