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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yched’s picture

Component: text.module » nodereference.module

You 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).

ray007’s picture

sorry 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?

yched’s picture

Well, then why not ? Patches welcome :-)

ray007’s picture

If 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.

yched’s picture

i 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)

ray007’s picture

FileSize
2.59 KB

all 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?

yched’s picture

Status: Active » Fixed

committed to 4.7 and 5.0. Thanks !

Anonymous’s picture

Status: Fixed » Closed (fixed)