My code used for D8 doesn't work anymore for D9. Custom region twig template for region into node twig template
I get thise error and WSOD:
Error : Call to undefined function entity_load_multiple_by_properties() dans themex_add_regions_to_node() (/home/xx/www/pfdev/multid9/recommended-project/web/themes/custom/themex/themex.theme ligne 145)
I notice that the condition on the region doesn't work too but I can render the content region with twig tweak syntax (outside the if condition):
{% if region_Zone_1 is not empty %}
<div {{ noderegion_attribute.addClass(noderegion_classes).setAttribute('id', 'region-zone-1') }}>
{{ region_Zone_1 }}
{# Avec le module twig_tweak #}
{{ drupal_region('region_Zone_1') }}
</div>
<!-- /#region-zone_1 -->
{% endif %}
So, what's the way to do the same thing or fix it for D9 ?
Thanks
EDIT: is this could fix my issue ?
$blocks = entity_load_multiple_by_properties('block', array('theme' => $theme, 'region' => $region));
replaced by:
$blocks = \Drupal::entityTypeManager()
->getStorage('block')
->loadByProperties(['theme' => $theme, 'region' => $region)]);