Closed (works as designed)
Project:
Drupal core
Version:
9.2.x-dev
Component:
views.module
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 Jun 2017 at 12:33 UTC
Updated:
15 Mar 2021 at 23:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
nedjoThis question relates to Drupal core rather than Display Suite.
What you're seeing is a result of #2377757: Expose Block Context mapping in the UI and #2287073: Allow views contextual filters to expose the context using argument validation plugins. The first issue made any contexts set for a block to show up in the UI. The second made blocks able to map contexts to the contextual filters (arguments) in views block displays.
To get an option to show up in the select when configuring the block, you need to set validation on the contextual filter. Specifically:
In your view, create a block display.
In the block display, add the contextual filter "Content: ID". Under "When the filter value IS available or a default is provided", check "Specify validation criteria" and select the "Content" validator. Save.
When you place the block, the select for "Content: ID" should now show "Node from URL".
Comment #3
nedjoComment #4
leo pitt commentedThanks
Comment #6
kreatil commentedI have set up a block view with a contextual filter that is based on a field value. How would I set up the block configuration (admin/structure/block) to pass a value to the view? Inside the block configuration, the contextual field is being shown to me, but it only comes along with an empty select list. Inside the view I already played around with validation criteria, but without success.
Comment #7
lblestel commentedSame as @kreatIL.
Because I need to display view blocks with data of several node fields, and I can't use the URL to get them (too ugly).
Anybody has an idea?
I've explored contexts of panelizer module, but I can't reach to properly set a context without breaking my website
Comment #8
joarferme commentedI was able to pass the values using Panelizer and contextual filter "Raw value from the URL".
Comment #10
slayer722 commentedHello,
I'm looking forward to do a similar thing as explained by @nedjo, but with a specific text field from the node that contain the custom block field.
This block field contains a view with a contextual filter for this specific field by I didn't find the way to configure and pass the value from the node to the view.
I tried with "Validator = Field" but it always shows "Empty" in "Display Suite/Fields/Edit a block field/Block config"
Hope there is way, I prefer to avoid to write code in a custom module.
Thanks in advance for your help.
Comment #14
devkinetic commentedI've been dealing with this, and I was able to work through it using the suggestions in #2. When using display suite also going into the block field config and selecting the argument from the dropdown.
Where I keep running into issues is when I have a contextual filter set to "fixed" on the block view. This flat out doesn't work. I tried setting the validation to "basic" and still nothing. To confirm I am able to render the same block through the block system without issue.
Comment #16
dmezquiaI need to expose taxonomy terms.
- I select in validation, taxonomy ID and it does not works?!?!? some solution?
Comment #17
devkinetic commented@dmezquia You need to edit the block field in display suite, as well as the view. The path to this page will look like this: /admin/structure/ds/fields/manage_block/***FIELD_NAME***/block_config. You have to select your argument from the select and hit save.
Comment #18
dmezquia@devkinetic I need this exposed tids filters for layout builder block, iam not using in this case display suite.
Comment #19
anruether@dmezquia Maybe you are looking for ctools_views plus #2759445: How to manually pass an argument to a views block through interface ?
Comment #20
kreatil commentedA workaround to accomplish this ("passing a value into a views contextual filter from a block field") would be to use Custom blocks. In my use case, I created a custom block type and added a Views Reference Field to it. Maybe the issue is even solved with this solution.
Comment #22
init90Initial problem was resolved.
Comment #23
thomasmurphy commentedThis solution only works for the full node view where the raw path is available, not for when the node is viewed elsewhere.
Comment #24
zserno commentedUsing DS, patch #14 from #2939322: Provide entity context to DS block fields fixed my issues.