// If 'template' is set, then we'll derive 'template_path' and 'theme_hook'.
$template =
$definition->
getTemplate();
if (!
empty($template)) { $template_parts =
explode('/',
$template);
$template =
array_pop($template_parts);
$template_path =
$path;
if (count($template_parts) > 0
) { $template_path .= '/' .
implode('/',
$template_parts);
} $definition->
setTemplate($template);
$definition->
setThemeHook(strtr($template, '-', '_'
));
$definition->
setTemplatePath($template_path);
} if (!
$definition->
getDefaultRegion()) { $definition->
setDefaultRegion(key($definition->
getRegions()));
} // Makes sure region names are translatable.
$regions =
array_map(function D
$region) { if (!
$region['label'
] instanceof TranslatableMarkup
) { // Region labels from YAML discovery needs translation.
$region['label'
] =
new TranslatableMarkup($region['label'
],
[],
['context' => 'layout_region'
]);
}