How do I hide an area in a template or layout if multiple regions have no content?
Your solution will work, but I think the best practice will be to make this check by preprocess 'theme_preprocess_page' and pass the result ( e.g. 'isRegionsEmpty') to the template. Then, in the template you only check one variable.