1

When a user search for a word the view should output its translation and any other vocabs that might be similar to it ( using Taxonomy terms ).

This works as the following:

The similar vocabs are actually another view that I pass ( Taxonomy ids ) to its URL as a contextual filter and it outputs all words that has the same Taxonomy term or terms. This view a lone by it self works fine when you pass Taxonomy terms manually. It doesn't produce any duplicates since I handled that by choosing 'Query settings: DISTINCT' and using aggregation.

However when I combine it with the other view and pass the Taxonomy terms using the Views UI it produce duplicates.

What should I do? Is there a way to write the view code manually or something like that?

0
1

Is there a way to write the view code manually or something like that?

You could easily setup a menu route and controller (or page callback in D7) to serve the same purpose. The controller would execute the query (provided by you) and return the results / page output as a renderable array.

However, there are many variables in between, so it would be hard to provide all the code.

Here is a walkthrough for D7 to starting to code your own route and callback: https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu/7.x

Here is one for D8: https://www.drupal.org/docs/8/api/routing-system/introductory-drupal-8-routes-and-controllers-example

It would be a good opportunity to learn how to extend Drupal and 'take control' when you don't get the result you want with Views, or, just to have more control in general.

7
  • Websmiths 404 not found
    – leymannx
    Dec 15 '16 at 18:49
  • Which also is the reason why it's necessary to rephrase links or to quote at least some key lines of code provided there
    – leymannx
    Dec 15 '16 at 18:50
  • Worked when I clicked on it.
    – Kevin
    Dec 15 '16 at 19:16
  • Does not when clicked in the app.
    – leymannx
    Dec 15 '16 at 19:19
  • Sorry... wasn't aware there is an app, I only use desktop. Changed the link to drupal.org page.
    – Kevin
    Dec 15 '16 at 19:22

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.