0

Is it possible to output all of the possible options in a list field type (of a content type) as a view?

  • Can you help me understand your use case? My guess is the easiest way to get something that looks like what you are talking about would be to replace the field with a Term Reference field. I have a situation where I do this and use the view of terms with counts to link to a filtered view that shows the specific items that have that term selected for the field. – rhuffstedtler Aug 22 '15 at 21:31
1

My own answer (but still feel free to chip in):

  1. Create a View of the Content Type containing the list.
  2. In the FIELDS section only have your Content Type Field that contains the list Content: (whatever the name of your list field is called)
  3. Click on your Content Type Field under FIELDS for the 'Configure field: Content: Your field' Under Multiple Field Settings, make sure display multiple fields on one row is unchecked
  4. add your Content Type Field to the FILTER CRITERIA. Filter should be set to 'is not empty' / not null
  5. over to the right hand side of the Views settings, enabled Aggregation
  6. back to FILTER CRITERIA and click Aggregation Settings for your content type field and select COUNT DISTINCT.

What this does is produce a unique list of items from all of the content that has this field with those items checked.

What it won't do is show items in from the list field if they have not yet been selected in any content.

It may also have a performance overhead to generate the list like this as it is based on the data from the entire set of content. The positive benefits flipside of this is that perhaps you only want to see items where there is content that has it checked and you may want to extend the list to include number of content using a list item.

Final thought - why did I not just use a taxonomy? this would have been far easier and Views supports this better. Reason: currently (at the time of writing), Views does not support context filtering on taxonomy where multiple arguments are provided in the URL. I want to use this list from this View as a menu block to filter data in a View in another block in Panels from multiple fields.

References / Credits:

How do I remove duplicates when using the random sort?

| improve this answer | |
0

The alternative option (the feasibility depends on the other requirements), would be to use a taxonomy vocabulary for holding all possible values.

In the node you can create a reference to a term in this vocabulary and use autofill or a drop down as a widget. In the node edit page you can list select the term you need.

In views you just load all terms of the given vocabulary.

In most cases I guess this will be easier, but you might have certain criteria they require the use of fields.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.