0

What is my goal?

I'd like to create a view for my users' profile page, similar to the 'Questions' block one finds on the user pages on this website. Instead of the user's questions, I'd like to display the articles he/she created. The users should be able to reorder/filter the articles in the view by clicking on "filter links"/tabs similar to the ones I marked in the underneath picture.

Tabbed view

I don't know the exact term for this, but I suppose one calls this a tabbed view.

What is my problem?

I can't find any suitable solutions for this functionality on the internet, but I've read a lot of similar requests. The main problem is that the view doesn't have its own page. That means: it should just be part of the user profile page, which has been overridden with "user_view" (see: How to create a profile page?) into a panels page. (This is exactly why the tabs in @Jhilke Dai's solution don't show up.)

It's also important that the path still contains the user's ID when one clicks on the tabs, because - of course - the Articles view needs this information, namely via the Contextual filter: (author) User uid > Provide default value: User ID from URL.

What did I try so far?

I've already created a view called Articles that displays all the articles that were added by the user. As any view would, it's displayed perfectly in the panel on my user profile pages. My next step was to add the tabs to the view. I followed @Jhilke Dai's answer to the letter, but as I mentioned before, the tabs don't show up when I don't give the Master display a normal menu entry (that's not what I want).

8
  • May be I didn't explain properly, anyways, I have updated my answer with Pictures, have a look, I hope you'll get the idea to do it for your site
    – user12947
    Commented Nov 19, 2013 at 22:51
  • 4
    This question appears to be off-topic because it is about implementing a functionality, or a layout seen in a site, for which only a screenshot or a site URL is provided, as defined in help center.
    – Mołot
    Commented Nov 20, 2013 at 10:17
  • @Mołot: I really regret that you and two other users marked this question as off-topic. In my opinion the question is a general request that only uses the comparison with Drupal Answers as a clarification. I hope that my update contains enough information about what I've already tried so far (there's no need to discuss it in detail, as everything is mentioned in Jhilke Dai's answer) and that you and the other guys will review their opinion about my question being off-topic.
    – Jeroen
    Commented Nov 20, 2013 at 14:57
  • 2
    The problem was in the fact that description of what you want was mainly in image - and thus unavailable for search engines. Now it's better and image really is only a clarification, so I can retract my vote.
    – Mołot
    Commented Nov 20, 2013 at 15:06
  • 1
    have you checked this modules drupal.org/project/panels_tabs , drupal.org/project/panels_ajax_tab
    – Bala
    Commented Jan 20, 2014 at 13:03

2 Answers 2

3
+25

Take a look at the QuickTabs module. You create a tabbed block via QuickTabs, with each tab itself being an already defined block, page, view, etc. Then you add the QT block to pages the same as any other. You will probably need to create your own style for the tabs (it does come with a handful of predefined styles) to achieve exactly what you want.

2
  • The QuickTabs module looked perfect, but for some reason, I always get a fatal error when I try to add a QuickTab to a panel. Any idea why? drupal.org/node/1910434
    – Jeroen
    Commented Jan 25, 2014 at 20:25
  • I am not entirely sure, but it seems like drupal is attempting to merge an array with an integer or string (maybe). Did you try applying the 'patch' here Commented Jan 27, 2014 at 15:59
4

You don't need 3 views, just create one view with 3 pages Votes, Activity and Newest. define your fields and filters. In Page Settings -> Menu Option, Use the Menu tab.

Edit: Exmaple

If Page Path for main view is mylist

  • Add Pages in View with Paths mylist/votes, mylist/activity, mylist/newest for all the 3 pages respectively
  • Select Menu Tab and Provide the Menu for Votes, Activity and Newest respectively

Above was the previous reply, here is answer with some graphics.

For the demo of your use case:

  • I created a taxonomy vocabulary called DSE with 3 terms Vote, Activity and Newest
  • I created a new content type called Drupal Stack Exchange, with Title, Questions and Tags field, where Tags field is Term Reference to DSE

In Views, I created a Master Display with Just Title field for demonstration, and I gave the Page path as questions like in this picture

enter image description here

For the Menu for Master display I selected Normal menu entry and selected Main Menu as its menu type:

enter image description here

Then I added the new Page for Activity, and in Path I gave questions/activity

enter image description here

In Menu for Activity, I selected Menu Tab and gave a title called Activity

enter image description here

In Filter for Activity I selected DSE Tag and chosed it to be one of Activity Tag like in the picture below. (Note: While adding filter select only this display)

enter image description here

I repeated the same process for Votes and Newest, as you can see Path settings for Newest is also the Menu Tab like:

enter image description here

Save the view and you'll see the New Menu called Questions in Main Menu, and clicking the Menu will give you 3 tabbed menu inside like:

enter image description here

Note: To make tabbed menu it is required the path to be on the same Path like in above case questions/vote for Vote tab, questions/activity for Activity tab.

Finally the Sneak peak of the View page

enter image description here

9
  • I don't want to create new paths. If one clicks on Votes, Activity or Newest on a user's profile page, the path remains the same too. It's important that the path doesn't change, because my views contain information that depends on it.
    – Jeroen
    Commented Nov 16, 2013 at 22:26
  • Then Ajax is your best friend. Implement it however you like. Load the whole view at once and use Ajax to toggle between links in the menu..
    – user12947
    Commented Nov 16, 2013 at 22:31
  • How can I use AJAX? I always have to fill in a path when I create a new page in my view, so I don't really understand what you mean.
    – Jeroen
    Commented Nov 16, 2013 at 22:34
  • When you create a page in view you'll see the Page Settings Right in the Middle. I am not sure if you understood my answer properly, I said to create Base Path and extend those paths for Specific Page. This way whatever information you are getting from Path will remain same. For Ajax you can use Custom JavaScript in your theme.
    – user12947
    Commented Nov 16, 2013 at 22:39
  • My main view doesn't have a path. It's just the Master display. When I click on the Menu option in the Page settings, there's no Tabbed menu option either...
    – Jeroen
    Commented Nov 16, 2013 at 22:45

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.