Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#10 | views-7.x-custom_boolean_output-1825116-10.patch | 5.3 KB | Les Lim |
#7 | views-add_1_0_boolean_display-1852116-7.patch | 2.65 KB | Les Lim |
#6 | views-add_1_0_boolean_display-1852116-6.patch | 2.6 KB | Les Lim |
#1 | views-add_1_0_boolean_display-1852116-1.patch | 995 bytes | Chris Burge |
Comments
Comment #1
Chris Burge CreditAttribution: Chris Burge commentedAttaching D7 patch.
Comment #2
stealth01 CreditAttribution: stealth01 commentedThis indeed would be a very handy option to have. I would like to see this happen as well.
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedRather 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.
Comment #4
Chris Burge CreditAttribution: Chris Burge commented@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.
Comment #5
mattiasj CreditAttribution: mattiasj commentedThis would really help out for alot of scenarios.
Comment #6
Les LimPatch attached implements merlinofchaos' custom option described in #3.
Comment #7
Les LimNew patch: same as #6, but with
'translatable' => TRUE
in the option definition for both new textfields.Comment #8
Les LimPatch adapted for D8 here: #1869124: Customizable "true"/"false" Views output for booleans
Comment #9
Chris Burge CreditAttribution: Chris Burge commentedThanks 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
Comment #10
Les Lim@Chris Burge: hope so!
Now that #1869124: Customizable "true"/"false" Views output for booleans is committed, here's the backport plus tests for D7.
Comment #11
dawehnerThis is nice stuff!
Comment #12
Chris Burge CreditAttribution: Chris Burge commentedSuccessfully tested patch #10 against Views 7.x-3.5.
Comment #13
dawehnerPerfect, thanks for backporting, and testing the patch.
Committed and pushed.
Comment #14
klonosThanx!!!