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.
When defining a text-field as select list, the advanced data settings allow me to get the list of possible values from a view.
Unfortunately, there's no way to add an argument to the view-call, or is there?
In my case, I have a view selecting all nodes of a certain type with an argument for a taxonomy term ... and I'd like to supply this taxonomy term when getting the allowed values for my select box.
Comment | File | Size | Author |
---|---|---|---|
#6 | cck-noderef-viewargs.patch | 2.59 KB | ray007 |
#4 | cck_datasettings_fieldgroups.patch | 2.28 KB | ray007 |
Comments
Comment #1
yched CreditAttribution: yched commentedYou must be talking about nodereference fields, not text fields.
I guess adding something in the 'advanced' part of the field settings to provide arguments to the view could be doable. It gets tricky if what you want are 'dynamic' arguments (meaning, dependent on the node).
Comment #2
ray007 CreditAttribution: ray007 commentedsorry for my error, it is a nodereference fields we're talking about.
one text-field to enter static arguments should be enough ... for dynamic things (which I don't need right now) maybe the token-module could be of use?
Optional gimmick: maybe the content-types and the advances options should go each in a collapsible field-group to use less space on screen if not needed?
Comment #3
yched CreditAttribution: yched commentedWell, then why not ? Patches welcome :-)
Comment #4
ray007 CreditAttribution: ray007 commentedIf you're talking about the field-groups, that's not too hard, maybe something like the attached patch?
Could probably be improved to open the sections if options inside are already set.
Don't yet know enough about the module to patch in the view-arguments.
Comment #5
yched CreditAttribution: yched commentedi was rather talking about the view arg stuff :-)
Not sure a fieldset is needed right now (maybe it will if we add the view arg setting)
Comment #6
ray007 CreditAttribution: ray007 commentedall right, all right, here a patch which also adds view-arguments to the noderefs.
credits go to the author of the 'viewfield' module, where I have have stolen some lines of code.
ok that way?
Comment #7
yched CreditAttribution: yched commentedcommitted to 4.7 and 5.0. Thanks !
Comment #8
(not verified) CreditAttribution: commented