Thanks for a cool module! It saved me a lot of time.

In my scenario, I still wanted content to display in my blocks even if the node passed in to the view through an argument didn't have any tags associated with it. So I added a config option in the attached patch that made your module support my scenario.

Please feel free to commit it or ask for revisions.

Comments

jienckebd created an issue. See original summary.

jienckebd’s picture

StatusFileSize
new2.72 KB

I messed up the logic in previous patch. This one works better.

luksak’s picture

Shouldn't this be achieved with something described in #1319114: Similar sort without filter? Having a filter in addidion would make your functionality already configurable.

kasey_mk’s picture

I like this idea too. In the meantime, I guess I'll make a "fallback" view to insert in the "no results behavior" area.

shelane’s picture

camilo.escobar’s picture

I rerolled the patch for version 8.x-1.9.

An important correction was also made. The patch in #2 introduced the following code:

if (empty($this->tids) && ($this->options['no_tags_bypass_filter'] !== TRUE)) {
  $this->query->addTable('taxonomy_index', NULL, NULL, 'similarterms_taxonomy_index');
  $this->query->addWhere(0, "similarterms_taxonomy_index.tid", $this->tids, 'IN');
}

However, the condition should check for !empty($this->tids) instead.

With the previous patch, the taxonomy join and filter are applied only when no term IDs are available, which is the opposite of the intended behavior. The filter should only be added when the view has term IDs to match against.

shelane’s picture

Status: Active » Closed (duplicate)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.