2

enter image description hereSo here is my use case: I have taxonomy vocabularies titled accommodation, and in the vocabulary, there are 4 terms.

  • hotel
  • motel
  • campground
  • guest housing

I want to create a view that displays in a page that has these four terms as menu links that once you click the link all content nodes containing that taxonomy term are listed. I have been struggling with this.

My main Block is creating a menu from taxonomy and linking it to the view(I would like to use a custom URL), I have tried the Taxonomy Menu module, which is close, but cannot figure how to configure it correctly, I have gotten closest creating an attachment display within the view. I am so close.

6
  • What's the problem with drupal.org/project/taxonomy_menu module? Commented Jan 10, 2017 at 21:25
  • I can create the requisite taxonomy menus, however, it seems the config options or placement of the config options have changed since the 8.x-3.3 and they have seemingly not updated documentation. The docs suggest that all routing config is available at structure>taxonomy>edit vocabularies , I am not finding that is the case in drupal 8.
    – traceh
    Commented Jan 10, 2017 at 23:12
  • You can't solve your problem with a view of taxonomy terms? If you make click over the terms you will go to the term page and you will see all the related nodes. Maybe I missing something. Commented Jan 11, 2017 at 0:23
  • I can't get the point. Can you provide some mockups? Commented Jan 11, 2017 at 0:42
  • I will try to include some in my post
    – traceh
    Commented Jan 11, 2017 at 1:03

1 Answer 1

1

Forget views here and write a few lines of own code here. I had this problem also recently. Views is much to unflexible. You must do the following:

  1. Create a route to your controller method
  2. Get all relevant nodes in the method
  3. Create a template via hook_theme() for the output.
  4. Realize all your details! ;)

I needed around ~1 hour for this.

4
  • Thanks, I am fairly green concerning Drupal and PHP. can you illustrate what this would look like. I am using Drupal 8.
    – traceh
    Commented Jan 10, 2017 at 23:57
  • If you are new to Drupal, then learn Drupal. Nobody will type the code for you for free. Sad but true. Check drupal.org/project/examples and buy a book about Drupal 8. Check routing, database queries + entity queries and taxonomies. My Permissions by Term module has also a lot of examples. Check the code.
    – jepster
    Commented Jan 11, 2017 at 20:35
  • Not looking for anybody to type code for me but, it's just my learning style I like looking at similar examples, then I adapt for my own uses, as I research topics to gain a deeper understanding along the way. I have solved this particular issue using views. After a little research and some mentorship, I found the fault was attempting to do everything using one view. My use case can be executed using two views one as taxonomy view and the second a content view. I will elaborate in an answer to this post.
    – traceh
    Commented Jan 12, 2017 at 22:47
  • Also thanks for pointing toward those topics I will research those.
    – traceh
    Commented Jan 12, 2017 at 22:49

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.