1
votes

tl;dr: Views Block, with contextual filter, WITH default value. Results show properly in preview, but NOT on the page. Page = taxonomy term page with a path alias. Running on Mongo.

=====

How my problem differs from all other contextual filter block issues I've seen:
- Using Mongo
- DO have a default value set on the Contextual filter
- Results show properly in views preview, but not on page

Using Drupal 7 on Mongo, with EFQ Views, I need to display all nodes of NODETYPE that have been tagged with term TERM, on TERM page. (With Drupal on Mongo, taxonomy index is stored in MySql but the node content in Mongo, so term pages don't work as expected, and return no content. So a view is necessary to establish this functionality. <-- Yes, this is really stupid.)

My Taxonomy is an entity with its own fields, & tagged content appears in a block, below the terms own fields. (This is why I didn't just make a page view to display tagged content -- bc. I must display the term's own fields.)

Taxonomy term pages have a path alias, "vocab/term-name".

Configurations I've tried that work successfully in preview but not on the page:

1: Using path alias.
Global: Null forarg(0)
Node: TAGS for arg(1)
When filter is NOT available:
- Provide default value: Taxonomy term ID from URL
- Load default filter from term page

OR
-- Raw value from URL, Path Component 2
-- "Use Path alias" Checked

When filter IS available:
- Validator: Taxonomy Term, Vocab TAGS
- Filter value type: Term name converted to Term ID
- Transform dashes in URL to spaces in term name filter values

2: Use Term ID
When filter is NOT available:
-- Raw value from URL, Path Component 3

When filter IS available:
- Validator: Taxonomy Term, Vocab TAGS
- Filter value type: Term ID

View results in preview appear correctly whether using the term name or term id in the C.Filter. But no matter how it's set, the block on the actual page returns all NODETYPE nodes.

On the taxonomy page, the block is displayed in a custom region, or in the Main content area of the page. In both cases, all nodes display, unfiltered. Ajax is enabled on the block, for good measure.

Topics I've read / tried that don't apply / don't work: (can only post 2, but I have 15):
Drupal 7 views Contextual filters with Page & Blocks
drupal 7 views block and contextual filter not working

1
Did you try to override/clone the default views taxonomy/%term page that is disabled on the views admin page (/admin/structure/views)?TheodorosPloumis

1 Answers

2
votes

Turns out the settings that worked were:

Contextual filter: Taxonomy TAGS
Default value: Raw value from URL, Path component 2 
Check "Use path alias"
When filter IS present - Specify validation Criteria
Validator: Taxonomy Term (from the checked vocab)
Filter value type: "Term name converted to Term ID"
Check "Transform dashes in URL to spaces in term name filter values"

The Global Nulls for arg(0) was in the way. Without that, just using the value for arg(1), things work fine.