Checking across Components?

How can I check in a Component whether another related Component exists on the page?

My Blog components need to have the ConfigureBlog Component on the page. If it isn’t added I would like flag that up in the Editor as being missing.

I was thinking of related Components checking for a property in the ConfigureBlog Component and then displaying a warning DIV between an ‘@if(edit) | @endif’ pair if it was missing?

Hmmm, I’m not sure what the best way to do this would be :thinking:
I’ll message the rest of the team and see if they have any ideas on doing this…

We don’t have a good solution right now, however we have a few ideas on how to handle this like automatically adding a “settings” component to the page when a component is added that requires it.

In the past, other editors have shown the warning in related components, and use some CSS in the configure component to hide it - it works but it’s not a great solution.

In the related component you might have this

<div class="com-realmac-blog-configure-error">
NEEDS CONFIGURE COMPONENT
</div>

And in the configure component you could have this

<style>
.com-realmac-blog-configure-error { display: none; }
</style>

Just be careful to use a unique class name to control the visibility like I’ve done above.