Both #668440: Add filters to layers and #650520: Translations for every entity require a way to set filters for layers. This issue is dedicated to creating a way to store information about global and layer-specific filters.

Comments

xano’s picture

StatusFileSize
new1.52 KB

Minor first stab.

xano’s picture

Title: Filter API » Conditions API
Assigned: Unassigned » xano
StatusFileSize
new13.31 KB

Technically filters are now entity_type only, while filters, global conditions and conditions to find children for parent entities are now called "conditions" as you can see in $index->conditions and $indexLayer->conditions.

This patch has three groups of conditions:
1) global, which are conditions that apply to all layers, like the language that is set only once for the index.
2) filters where configuration settings from entity type-specific filters should be put. See #668440: Add filters to layers for more information on that.
3) hierarchy, which contains the condition to find find child entities for a parent. This array may only contain ONE item or the code will break. This isn't a good thing, so we'll need to come up with a solution for that.

hierarchy needs to be used at all times to generate a correct entity hierarchy. global is optional, as not all entity types can be translated, for instance. filters is optional as well, logically because not all entity types may have filters defined.

a) This can work, but I'm still not content with how we store this data. It looks too rigid too me, not flexible enough.
b) Allowing multiple conditions in hierarchy will break stuff, which is tricky. Shouldn't be possible.

Any input is appreciated :)

PS: this patch isn't fully functional. Not all entity types have been updated and the ones that have are still buggy. It's only useful to take a look on the initial approach.

xano’s picture

StatusFileSize
new7.75 KB

This patch has just been committed. It allows more advanced where clauses for queries, which is necessary for this issue, bur for others as well.

dgastudio’s picture

can u please provide any example about how to aplly a filter (by vocab) to existing block index?

xano’s picture

This is an API, which means it is of no use to end users. There is currently no way to filter items and there won't be any way to do so for at least a couple of weeks.

dgastudio’s picture

it's ok.

When conditions feature will be finished i'll back to this module (i really like it). But for now i have to use advanced taxonomy block.

good luck.

xano’s picture

Assigned: xano » Unassigned

  • Xano committed d05de8f on 8.x-1.x
    Added #735164: Added functions to create more flexible where clauses for...