I'm creating a node--page.html.twig and I'm using twig_tweak to help render a block for my sidebar to display the sub-menus. Is there a way to hide it if the page doesn't have any submenus?
Here's my code:
<div class="page-sidebar grid-3 alpha">
<div class="sub-region page-sidebar clearfix widgets widget-sidebar">
<div class="contextual-links-region panel-pane pane-menu-tree pane-main-menu">
{{ drupal_entity('block', 'mainmenu', check_access=false) }}
</div>
</div>
Is there some sort of if
statement I could use to hide the block if the page has no submenu?
Thank you!