I have a content type "Slider" which uses an Entity reference revisions field named "Slides" to save reference to various paragraphs that are then displayed on the frontend as a hero slider.
Everything works fine but now we have received a request of filtering out the slides by a show/hide boolean flag in the slide paragraph. Adding a boolean field to each such paragraph is straightforward but how do I filter those paragraphs based on it? I'm assuming a Drupal hook that allows a function to filter out the referenced entities by some arbitrary criterion but I've been unable to find it.
I understand that this question relates to a 3rd party module but it is quite possible that a core Drupal hook could be used in this context.
Any help will be greatly appreciated.