1

So I'm trying to create a view on a slideshow content type. I want to create multiple slideshows. However, whenever I create a slideshow, I want to run a slideshow that only displays the slides from the paragraphs I created in that specific node.

NOTE: I don't want to add filters that only show from that specific node ID. I want something that works exactly how field collection views worked in Drupal 7.

Anyone know of any solutions?

[Update]

So while I started to go into this, I decided to change route of what I wanted to do. Learning more about how Drupal 8 works, I decided to change from making a slideshow content type to creating a new block type for slideshows. Inside the new block type I am using paragraphs for the slide information.

What I want to do is create a display view for the slides in each block type created (slideshow).

In my views settings I created a context filter by Paragraph ID. It's almost where I want it to be however, my view is only displaying the first item of the paragraph (the first slide fields). Its not until I put, (display all fields inline) does it show my slides. However, this doesn't help me with using flexslider or slideshow. I need them to be separate to have the slideshow work properly.

When I go to my fields tab and I look at my Slides (Paragraph). Under "Multiple Field Settings" it has the checkbock "Display all values in the same row".

I obviously want this unchecked because I need them to be in different rows for the slideshow to cycle though. If I leave it unchecked it only shows the first item in the paragraph.

Lastly, under the checkbox it says "If not checked, each value in this field will create a new row. If using group by, please make sure to group by "Entity ID" for this setting to have any effect."

However, it's not doing that, it just shows the first item and that's it. I'm not using grouped by so the last part shouldn't matter...at least I think it shouldn't.

"Help me, I'm poor"

7
  • Why do you specifically want to avoid filtering by the node id? Sep 15, 2017 at 18:50
  • Because, when I create a new node, I don't want to have to create a new view block filtering each node every time. I'm trying to make this as easy as possible to end users who aren't Drupal savy. I want them to simply go in, create a slideshow and then it just works, without me teaching them how to create a new view and changing the filter. My goal is for it to be as simple as possible. Sep 15, 2017 at 19:00
  • Ah, but in that case you should be able to use a contextual filter. A dynamic filter that will obtain context from the viewed page. These are in the views advanced section. Add a contextual filter for nid, choose to provide a default: node id of current node, and save. That will filter your view automatically for the node you are looking at. Alternatively EVA might be useful too. It works slightly different, but also uses the id dynamically. Sep 15, 2017 at 19:03
  • Thanks! I'm going to give this a try and see if this is accomplishing what i'm looking for. I figured it was something to do with the advanced section, but I wasn't sure how to set it up exactly. I'm going to try this and get back. Sep 15, 2017 at 21:01
  • So, before i flip over my desk, I almost have this working. i'm missing something here. So the way I set it up in drupal 8, I'm using their blocks library. I have it displaying the images in the block it was created however it's not showing multiple values. It's deiniftely reading multiple values because when i put it on the same line, both images show. However if I uncheck it, it says make sure it's group my entity ID....I have no idea what it's talking about....where do i group my entity ID? Sep 15, 2017 at 23:06

2 Answers 2

0

Apparently I misunderstood. You are building a distribution with one slideshow block that comes pre-positioned in the distribution. Depending on the page you are looking at, that slideshow should display other slides.

Make sure that on your slideshow container entity you have an entity reference field to a node, allowing people to choose on which node page the slideshow should appear.

Then in the view, create a views block. You will need a relationship from the paragraph to the container entity. Then you need a second relationship from the container entity to the node that is referenced via the 'place on this page' field. Then add a contextual filter to see if the id of the 'place on this page node' equals that of the currently viewed node (use the drop down to select the right relationship).

2
  • I'm going to give this a try. Do you still recommend that I do this through a content type over a custom block type? Sep 19, 2017 at 15:58
  • I thought the users would have to place the views block and would be confused by creating one and placing the other. If they never see it, it is of less importance. If you use a content type the slideshow will show up in the 'content' page of the admin panel. (Peronally I think it is content) Sep 19, 2017 at 16:01
1

To start, I cannot think of any benefits for creating a block type to act as a container element for slideshows. Especially since you will be using views to create the slideshow. If you like, please write in a comment why you felt it was a good idea. IMO content types make more sense.

The main cause of your problem is probably a misunderstanding of what is happening. A paragraph field on a drupal entity (block, node, whatever) is a one to many relationship. Every paragraph you add to the field will be a separate entity with its own id. If you have a contextual filter on the paragraph id, it does make sense that Drupal only loads one slide. You instruct it to load one id. (In fact I am surprised that you somehow managed to show more).

Normally you would add the reverse relationship (from paragraph item to container entity) and then use a contextual filter on the container entity: I would create a slideshow of paragraph items, add a relationship to the node and then use a contextual filter on node id. Then if I filter on node id 1, I would see all paragraph items linked to node 1.

Since you are now dealing with a block, I think you might be able to build a similar construction (relationship to the block and contextual filter on block id?) But I encourage you to reconsider.

5
  • So here's the goal of what I'm trying to do. I'm in the middle of developing a drupal 8 distribution for about 150 + different organizations to take advantage of (possibly a lot more once more get on board). My goal is to make it as easy as possible for them to create slideshows. Not only for one page but for as many pages as they see fit. They aren't the most tech friendly people so i'm "building a site my mom can use" [continue to next comment] Sep 19, 2017 at 15:22
  • I was leaning towards a custom block type because I felt like it would be easier to place it where they want on what pages they want. I'm still open to a content type if you know of a solution in drupal 8 that allows me to easily assign the slideshow that is made to it to the block it should fall in. Sep 19, 2017 at 15:24
  • @TheGentleman We have this whole discussion about views and contextual filters. I was pretty sure you were gonna place the slideshow as a views block with a contextual filter. In that case I find it particularly confusing for people because you create the slideshow in one block, but then should place another block to make it work. Then again, perhaps I have misunderstood you. Sep 19, 2017 at 15:26
  • well yeah, either way, I need a view to display the slides I load in paragraph, right? Here's the workflow for the customer: create a slideshow (either custom block type or content type + paragraphs) ---> assign it to a page ---> slideshow appears on that page in the designated slideshow area [see next comment for my thoughts of the technical workflow] Sep 19, 2017 at 15:39
  • Techinical workflow: slideshow is created in paragraphs on either content type or custom block type ---> content type or custom block type displays paragraph as a view ---> view should only take the slides from that content type or custom block that was created ---> gets assigned to the slideshow block area on the page the user specifies Sep 19, 2017 at 15:42

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.