I have an content type (bundle) "Journal" that has a field "journal number" (integer field) and an entity reference to "Document" bundle. I have a view that lists"document" objects as a table. I want to add there a number of journal referencing to the "Journal" item. It can be done via Relations in Views. But then I want to see this number as a link to corresponding journal. I see two ways there:

.1. that number is shown as a link via "override" option of the field with hardcoded url. (I use pathauto with custom patterns which means that I'm to monitor that hardcoded with "override patterns" urls to be correspondent to their actual urls provided by pathauto)

Pros: the field is sortable as an integer (I want it to be that).

Cons: if Pathauto patterns change, the views overide patterns should be changes correspondingly by hand.

.2. Add a field "Link" referencing to that journal and override this field with a journal number field.

Pros: linking system works without any crutches: Pathauto pattern changes -> link to journal will still work.

Cons: The overriden property is NOT SORTABLE

How can i get both beiing a link and sortable ability as a number for a field?


You should use the first option, but with a slight alteration. If you use the base url when you create a link using override - views will render the link using the Drupal APIs and the the link will use any path alias created.

So all you have to do is to create the link like: node/[nid], instead of doing content/[title]. These urls are examples.


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.