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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Chris Burge’s picture

Attaching D7 patch.

stealth01’s picture

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

merlinofchaos’s picture

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.

Chris Burge’s picture

@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.

mattiasj’s picture

This would really help out for alot of scenarios.

Les Lim’s picture

Status: Active » Needs review
FileSize
2.6 KB

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

Les Lim’s picture

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

Les Lim’s picture

Chris Burge’s picture

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

Les Lim’s picture

Title: Add 1/0 boolean display » Backport from D8: Customizable "true"/"false" Views output for booleans
Version: 7.x-3.5 » 7.x-3.x-dev
FileSize
5.3 KB

@Chris Burge: hope so!

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

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

This is nice stuff!

Chris Burge’s picture

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

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Perfect, thanks for backporting, and testing the patch.

Committed and pushed.

klonos’s picture

Thanx!!!

Status: Fixed » Closed (fixed)

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