Skip to main content
added 621 characters in body
Source Link
Matt Campbell
  • 637
  • 1
  • 7
  • 18

Yes you can achieve this using views and view relationships.

  • Create a new view selecting the content of the parent content type containing the paragraphs field. In my case, Projects.
  • Now add a new Relationship under the Advanced section. Choose the name of the paragraph field. In my case, I have a paragraph field named field_project_contacts which is on my parent Projects bundle.
  • Now with that relationship set you can select the individual fields within the paragraph.
  • Under filter criteria, add a new filter for the taxonomy term field inside your paragraph. In my case field_role is a taxonomy reference on my paragraph. When adding filter criteria you can choose a relationship. It will automatically pickup the relationship to the paragraph that you previously added.
  • Now it will filter my projects by a specific term located on any of its contacts.

WithAlthough there are multiple ways of doing this relationship you can add any fields from your paragraph. From, here many thingsis probably one of the better ways if editor/front-end control is what you are possibleafter. For something more specific you would needThese days, paragraphs are pretty commonly used to illustrate an examplegive easier control to editors.

Important Note Regarding Paragraphs and Views: Paragraphs unfortunately keep ALOT of revision junk in the database. Views does not correctly pull paragraph data currently It will be setup a little differently however. This is an open issue

  1. First, install and enable the block_field module. This will create a new type of reference field. We will use this later on.
  2. Create a new View, choose Block display. Choose the Article bundle for your content. Add some fields from Article that you want to see. Add a new basic filter criteria for the category term reference field. Set its default value to Sports.
  3. You should now have a view showing all articles where the category contains sports. Now duplicate this sports block, make another block for politics, and so on. Changing the filter criteria to match each term. enter image description here
  4. Your view should have a few blocks in it now. One for each term. Now go edit your Multi Article Paragraph type.
  5. Delete your term reference field from the paragraph, and add a new field. Under references you will see a Block (plugin) now. Choose that. Name it whatever, set to unlimited. enter image description here
  6. On your new field, at the very bottom, drop down the Blocks fieldset. By default every block will be checked, uncheck them. Scroll down until you see your 3 view blocks you made. Check each of them. Then save the field. enter image description here
  7. Now go create a new landing page as if you are an editor. Your Multi Article paragraph will have a block reference. Choose add block, and pick one of the view blocks. Add a paragraph item for each view block you want to display.

enter image description here

If you plan on using paragraphs and views you will needYou can then make many landing pages, allowing the editor to implement a methodchoose which types of deleting paragraph revisionsarticles to display. Currently thisHere is most easily done by using Paragraphs Cleanmy landing page A.

enter image description hereenter image description here

Yes you can achieve this using views and view relationships.

  • Create a new view selecting the content of the parent content type containing the paragraphs field. In my case, Projects.
  • Now add a new Relationship under the Advanced section. Choose the name of the paragraph field. In my case, I have a paragraph field named field_project_contacts which is on my parent Projects bundle.
  • Now with that relationship set you can select the individual fields within the paragraph.
  • Under filter criteria, add a new filter for the taxonomy term field inside your paragraph. In my case field_role is a taxonomy reference on my paragraph. When adding filter criteria you can choose a relationship. It will automatically pickup the relationship to the paragraph that you previously added.
  • Now it will filter my projects by a specific term located on any of its contacts.

With this relationship you can add any fields from your paragraph. From here many things are possible. For something more specific you would need to illustrate an example.

Important Note Regarding Paragraphs and Views: Paragraphs unfortunately keep ALOT of revision junk in the database. Views does not correctly pull paragraph data currently. This is an open issue

If you plan on using paragraphs and views you will need to implement a method of deleting paragraph revisions. Currently this is most easily done by using Paragraphs Clean

enter image description here

Although there are multiple ways of doing this, here is probably one of the better ways if editor/front-end control is what you are after. These days, paragraphs are pretty commonly used to give easier control to editors.

It will be setup a little differently however.

  1. First, install and enable the block_field module. This will create a new type of reference field. We will use this later on.
  2. Create a new View, choose Block display. Choose the Article bundle for your content. Add some fields from Article that you want to see. Add a new basic filter criteria for the category term reference field. Set its default value to Sports.
  3. You should now have a view showing all articles where the category contains sports. Now duplicate this sports block, make another block for politics, and so on. Changing the filter criteria to match each term. enter image description here
  4. Your view should have a few blocks in it now. One for each term. Now go edit your Multi Article Paragraph type.
  5. Delete your term reference field from the paragraph, and add a new field. Under references you will see a Block (plugin) now. Choose that. Name it whatever, set to unlimited. enter image description here
  6. On your new field, at the very bottom, drop down the Blocks fieldset. By default every block will be checked, uncheck them. Scroll down until you see your 3 view blocks you made. Check each of them. Then save the field. enter image description here
  7. Now go create a new landing page as if you are an editor. Your Multi Article paragraph will have a block reference. Choose add block, and pick one of the view blocks. Add a paragraph item for each view block you want to display.

enter image description here

You can then make many landing pages, allowing the editor to choose which types of articles to display. Here is my landing page A.

enter image description here

Source Link
Matt Campbell
  • 637
  • 1
  • 7
  • 18

Yes you can achieve this using views and view relationships.

  • Create a new view selecting the content of the parent content type containing the paragraphs field. In my case, Projects.
  • Now add a new Relationship under the Advanced section. Choose the name of the paragraph field. In my case, I have a paragraph field named field_project_contacts which is on my parent Projects bundle.
  • Now with that relationship set you can select the individual fields within the paragraph.
  • Under filter criteria, add a new filter for the taxonomy term field inside your paragraph. In my case field_role is a taxonomy reference on my paragraph. When adding filter criteria you can choose a relationship. It will automatically pickup the relationship to the paragraph that you previously added.
  • Now it will filter my projects by a specific term located on any of its contacts.

With this relationship you can add any fields from your paragraph. From here many things are possible. For something more specific you would need to illustrate an example.

Important Note Regarding Paragraphs and Views: Paragraphs unfortunately keep ALOT of revision junk in the database. Views does not correctly pull paragraph data currently. This is an open issue

If you plan on using paragraphs and views you will need to implement a method of deleting paragraph revisions. Currently this is most easily done by using Paragraphs Clean

enter image description here