0

I know my title isn't explicit, but i will explain my problem. I created a view that displays me all documents(content) of my website, some documents are linked to a project(content) via entity reference, and in my view I display a link to a document. if there is a project the link looks like : node/100?project=5 . If there is no project the link needs to look like : node/100.

So in my view I added field excluded from display with the id of the project, and a second field which is the id of the node document and I rewrite the link to :

node/[nid]?project=[field_doc_project]

My problem is: This works fine for document with projects only. good url: node/100?project=5 bad url, without project: node/100?project=.

Can I check in view if the project id exists and rewrite the url to node/100?

thanks

0

almost there,

  1. add a link to the original content as a field, exclude it from display
  2. add a path to the original content as a field, exclude it from display fields
  3. rewrite the term reference to the full url you want to have using replacements [path]?something=[someid] reference url rewrite

  4. add a no results behavior and output the link from 1) [view_node] no results behavior

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.