I have a content type with a Node Reference field, so the user can select from a list of node titles. I need to filter out some nodes from the list (those that have a date field older than the current date).

I know that hook_form_alter() can be used to modify the display and validation of form fields, but probably not change the query that the field uses. So I think I need to write some kind of preprocess function for this field, that does a second filter on the contents?

Any pointers on how to do this would be great - thanks.

1 Answer 1


Have a look at Restricting node reference values to owner

As described there, you can select a view as the source for the node reference selection. In that view, you can apply whatever conditions you want to that list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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