// This callback can be used to prepare the context. For instance to replace
// tokens in the props.
$props =
array_reduce( $props_alter_callbacks,
fn(array
$carry, callable
$callback) =>
$this->
doTrustedCallback( $callback,
[$carry],
'%s is not trusted',
),
$props );
$inline_template =
$this->
generateComponentTemplate( $element['#component'
],
$element['#slots'
],
$element['#slotsAlter'
],
$props,
);
$element['inline-template'
] =
[ '#type' => 'inline_template',
'#template' =>
$inline_template,
'#context' =>
$props,
];
return $element;
}