public function __construct(array
$defaultThemes, Environment
$environment) { parent::
__construct($defaultThemes);
$this->environment =
$environment;
} public function renderBlock(FormView
$view, mixed
$resource, string
$blockName, array
$variables =
[]): string
{ $cacheKey =
$view->vars
[self::CACHE_KEY_VAR
];
$context =
$this->environment->
mergeGlobals($variables);
ob_start();
// By contract,This method can only be called after getting the resource
// (which is passed to the method). Getting a resource for the first time
// (with an empty cache) is guaranteed to invoke loadResourcesFromTheme(),
// where the property $template is initialized.
// We do not call renderBlock here to avoid too many nested level calls
// (XDebug limits the level to 100 by default)
$this->template->
displayBlock($blockName,
$context,
$this->resources
[$cacheKey]);