TransWikia.com

Filtering/Searching fields with enumerated data (e.g. Smart Map) in an ElementCriteria model

Craft CMS Asked by Tim Kelty on March 30, 2021

I have an ElementCriteriaModel in which I need to find elements that contain a particular value for “state”, which is a property of a “Smart Map” field ($element->smartMapField->state).

Filtering after a find would be easy, but I need to do this in the ElementCriteriaModel, as I am passing it to the ‘criteria’ option for ElementAPI (https://github.com/pixelandtonic/ElementAPI).

One Answer

UPDATE

As of Smart Map 2.3.0, this is now possible!

https://plugins.doublesecretagency.com/smart-map/filtering-entries-by-subfield-value/


ORIGINAL

Currently, this isn't possible. However, it's a popular feature request which is rising quickly on the priority list.

The current workaround (as you noted) is to simply filter the results afterward.

Correct answer by Lindsey D on March 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP