When I add the "Node: Published" field to a view, it has a dropdown for "Output format" that is Yes/No, True/False, On/Off. I would like one more that is "Published/Not Published". Even better, I would like a custom option so that I could tweak these identifiers to fit the situation and use them for labeling.

I found that you had created a patch to provide a "Stickey /" format option for the Sticky field in http://drupal.org/node/496840. Can the same patch be used for providing a "Published/Not Published" format option for the Published fied i.e. replace "sticky" with "published"?

I couldn't even begin to guess how to provide a custom option.

Thanks!

CommentFileSizeAuthor
#6 views-905712.patch514 bytesdagmar
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mastoll’s picture

Views folks, any thoughts?

dawehner’s picture

You linked already the issue which really helps here :)

I guess you would be able to patch views.

mastoll’s picture

So, the patch used to provide new "sticky" output formats (http://drupal.org/node/496840) could also be used for new "published" output formats? With modifications of course since that patch very specifically talks to the "sticky" parameter.

How should the patch be modified to address the "published" parameter?

dawehner’s picture

The patch in the other issue allows to specify new output formats in the node.views.inc file.

Glottus’s picture

Since On/Off, True/False/ Yes/No are already options, would 1/0 also be an option (in addition to Published/ )? That would then tie in with the "treat 0 as empty" and "hide if empty" options to allow for additional flexibility (custom empty text, for example).

[Edit: Or perhaps instead, another config option to treat Off/False/No as empty (the way 0 would be)? This would be useful in many areas where the result is binary in nature. Even better if the "reverse" option would still work for use cases where that makes more sense.]

dagmar’s picture

Version: 6.x-2.11 » 6.x-3.x-dev
Status: Active » Needs review
FileSize
514 bytes

Here is the patch.

merlinofchaos’s picture

Status: Needs review » Fixed

Committed to all branches. I capitalized the names but otherwise the patch is the same. I decided this was worthy of 2.x as well because it's non-invasive.

Status: Fixed » Closed (fixed)

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