# Detect if a field is used with cbHasField in repeater Fields

**URL:** <https://forum.modmore.com/t/detect-if-a-field-is-used-with-cbhasfield-in-repeater-fields/2703>\
**Category:** ContentBlocks\
**Created:** [July 28, 2026, 1:08pm UTC](https://forum.modmore.com/t/detect-if-a-field-is-used-with-cbhasfield-in-repeater-fields/2703 "2026-07-28T13:08:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![webmasterunifr](https://forum.modmore.com/user_avatar/forum.modmore.com/webmasterunifr/32/120_2.png) [@webmasterunifr](https://forum.modmore.com/u/webmasterunifr)\
**Post date:** [July 28, 2026, 1:08pm UTC](https://forum.modmore.com/t/detect-if-a-field-is-used-with-cbhasfield-in-repeater-fields/2703/1 "2026-07-28T13:08:54Z")

</div>

In ContentBlocks, I have an element that creates an accordion. This accordion is of the “Repeater” type.  
In each element of the accordion, I add content, which can be formatting, text, other elements, or even nested elements.  
How can I detect, across all levels, whether a specific element is present? At the top level, `cbHasField` works, but not for the other levels. Has anyone else worked on this issue before?

---

<div class="post-metadata">

**Author:** ![mhamstra](https://forum.modmore.com/user_avatar/forum.modmore.com/mhamstra/32/459_2.png) [@mhamstra](https://forum.modmore.com/u/mhamstra)\
**Post date:** [July 28, 2026, 2:05pm UTC](https://forum.modmore.com/t/detect-if-a-field-is-used-with-cbhasfield-in-repeater-fields/2703/2 "2026-07-28T14:05:58Z")

</div>

This would require inspecting the nested data for that field, which is not something we do in core at the moment.

---

<div class="post-metadata">

**Author:** ![webmasterunifr](https://forum.modmore.com/user_avatar/forum.modmore.com/webmasterunifr/32/120_2.png) [@webmasterunifr](https://forum.modmore.com/u/webmasterunifr)\
**Post date:** [July 28, 2026, 2:38pm UTC](https://forum.modmore.com/t/detect-if-a-field-is-used-with-cbhasfield-in-repeater-fields/2703/3 "2026-07-28T14:38:39Z")

</div>

Thanks, Mark, for this information. Since I’m handling this action at the time of saving (to store a relative path), I can take the time to traverse the element tree.  
Is there a way to retrieve the tree via a query or an object’s value? Or can I use the JSON properties? What do you recommend for creating my own snippet that traverses the entire ContentBlocks structure created this way?
