0

I have a Drupal 8's views page in which Title and body of a specific content type is listed. I have enabled the title to link its content (node).

Supose if I have a list of 10 titles with its body listed, is there any way to override the link of one or two titles in order to redirect to a different page rather than its content/node.

  • Is it a field or an entity view? – sgoelz Apr 7 '17 at 6:44
  • This can be possible with global php in views ,use database select query load the specific node(say node id=12) ,then find its title,link it to custom url – user52318 Apr 7 '17 at 9:01
  • @Vikramfz16 i think using global php in views is not a good idea as it has some security concerns – Lalas Muathasim Apr 8 '17 at 5:50
0

I could achieve this by using jquery. I attached a jquery in global library (To add jquery and css to drupal 8 refer this page)

I needed a url redirection while clicking on the link /node/7 from the views field to /another-page. The jquery for which is as follows

$('.view-class a[href$="node/7"]').attr('href', '/another-page');

This selects the anchor tag with the 'view-class' and href attribute value ends with 'node/7' and redirects to '/another-page'

| improve this answer | |

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.