I am in need of a way to have the results of a view to be rendered as a select list (drop-down preferably) and that to be a field in a content type. It seems that I'm not the only one looking for something like that:
...although that thread is specifically about entity reference fields, in my case I simply want to use the content type as the means for exposing the options of this select field to specific users and allowing them to edit the list. But this can be on our roadmap because we plan to have references in core anyways AFAIK.
I thought that this could perhaps be implemented as a views display (like we do for views-generated blocks) and then have this as an available option to select the field settings "Allowed values list" (mockup):
I looked in d.org for any related modules. Here are my findings:
Entity Reference View Widget (screencast to see it in action)
This module provides an advanced Entity Reference widget that uses a view embedded in a modal dialog for selecting items. The view can be paginated and have exposed filters.
...not exactly what I was after in my specific use case because it uses a modal while I was after a drop-down select list, but very interesting nevertheless.
EntityReference Dynamic Select Widget
This module provides an advanced Entity Reference widget that uses a special select control for selecting items. The select form element options are generated by a view with a special display. This special display strips out any HTML in the view's row results so that it can be used as select options.
This one renders the view results as a drop-down and also optionally has an AJAX filter for the values of the list (don't really care about that feature in my use case, but thought it's worth the mention)...
The widget filter text box can be used to limit the number of options using view's filters selected in the widget settings. When the widget button is clicked, an AJAX call passes the filter text to the selected view's filters and the select form element is refreshed with the view results.
Here's what it looks like:
Thoughts? Core-worthy you think?
Recent comments
Welcome to Backdrop! For your setup, you’ll want to create a subtheme of Bootstrap5 Lite itself; the Bootswatch styles (like Cerulean) are just presets that B5 Lite loads, and you can “lock in”...
Basic Theme designing questions, using Bootstrap5 Lite
Hi Rob, Welcome to Backdrop! Here’s a quick overview: Subtheming Bootswatch: You should create your subtheme based on Bootstrap5 Lite, not directly on a Bootswatch style....
Basic Theme designing questions, using Bootstrap5 Lite
Hi Rolf, This happens because CKEditor saves absolute or semi-absolute paths in the HTML instead of using Backdrop’s file stream wrappers (like public://). When you move your site...
Losing link to embedded pictures when moving my installation