Currently the following are available as boolean displays:

  • Yes/No
  • True/False
  • On/Off
  • Enabled/Disabled
  • ✔/✖
  • Published/Not Published

This issue proposes adding 1/0 as a boolean display option.

Use case: Exporting nodes as XML using Views module and Views Data Export module. Importing XML using Feeds modules and Feeds Xpath Parser module. Feeds modules requires published status to be provided as 1 for published and 0 for unpublished.

Files: 
CommentFileSizeAuthor
#10 views-7.x-custom_boolean_output-1825116-10.patch5.3 KBLes Lim
PASSED: [[SimpleTest]]: [MySQL] 1,609 pass(es).
[ View ]
#7 views-add_1_0_boolean_display-1852116-7.patch2.65 KBLes Lim
PASSED: [[SimpleTest]]: [MySQL] 1,555 pass(es).
[ View ]
#6 views-add_1_0_boolean_display-1852116-6.patch2.6 KBLes Lim
PASSED: [[SimpleTest]]: [MySQL] 1,555 pass(es).
[ View ]
#1 views-add_1_0_boolean_display-1852116-1.patch995 bytesChris Burge
PASSED: [[SimpleTest]]: [MySQL] 1,555 pass(es).
[ View ]

Comments

StatusFileSize
new995 bytes
PASSED: [[SimpleTest]]: [MySQL] 1,555 pass(es).
[ View ]

Attaching D7 patch.

This indeed would be a very handy option to have. I would like to see this happen as well.

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.

@merlinofchaos, I agree with the idea of a custom setting. It would certainly be an improvement upon the patch in #1. Unfortunately, I lack the necessary coding skills.

This would really help out for alot of scenarios.

Status:Active» Needs review
StatusFileSize
new2.6 KB
PASSED: [[SimpleTest]]: [MySQL] 1,555 pass(es).
[ View ]

Patch attached implements merlinofchaos' custom option described in #3.

StatusFileSize
new2.65 KB
PASSED: [[SimpleTest]]: [MySQL] 1,555 pass(es).
[ View ]

New patch: same as #6, but with 'translatable' => TRUE in the option definition for both new textfields.

Thanks for writing this patch. It tests successfully for me. Is the plan to backport whatever comes out of the D8 issue? #1869124: Customizable "true"/"false" Views output for booleans

Title:Add 1/0 boolean displayBackport from D8: Customizable "true"/"false" Views output for booleans
Version:7.x-3.5» 7.x-3.x-dev
StatusFileSize
new5.3 KB
PASSED: [[SimpleTest]]: [MySQL] 1,609 pass(es).
[ View ]

@Chris Burge: hope so!

Now that #1869124: Customizable "true"/"false" Views output for booleans is committed, here's the backport plus tests for D7.

Status:Needs review» Reviewed & tested by the community

This is nice stuff!

Successfully tested patch #10 against Views 7.x-3.5.

Status:Reviewed & tested by the community» Fixed

Perfect, thanks for backporting, and testing the patch.

Committed and pushed.

Thanx!!!

Status:Fixed» Closed (fixed)

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