Skip to content

SlotParameterOverlay

Puts a slot’s own parameters on the shared request for the length of its dispatch, and takes them off again afterwards.

A slot receives arguments, but the action it dispatches reads them from the request like any other action — so the arguments have to be visible there and then stop being visible, or one slot’s arguments leak into everything rendered after it.

What gets restored is what the request exposed at overlay time, which is the validated request rather than what the client submitted: a parameter validation pruned must stay pruned, since putting the submitted value back would publish unvalidated input to the rest of the page.

A name the parent did not have is revoked rather than blanked. setParameter() adds a whitelist entry, and leaving the name declared would turn a later getParameter() from a refusal into a silent null.

Every restore failure is reported and the rest still attempted: each name left behind is one the parent request now reads with this slot’s value.

final class SlotParameterOverlay

SourceExecution/Slot/SlotParameterOverlay.php

public function __construct(Context $context, CategoryLogger $logger, string $slotKey): mixed

ParameterTypeDescription
$contextContext
$loggerCategoryLogger
$slotKeystring

Returns mixed

MethodDescription
apply(array<string, mixed> $parameters): WebRequestApplies the slot’s parameters, remembering what each name held before.
restore(?WebRequest $request): voidPuts the parent’s parameters back and republishes the request.
wasApplied(): bool

public function apply(array<string, mixed> $parameters): WebRequest

Applies the slot’s parameters, remembering what each name held before.

ParameterTypeDescription
$parametersarray``<``string``, ``mixed``>

Returns WebRequest — The overlaid request, published to the context.

ThrowsWhen
RuntimeExceptionif there is no request to overlay onto.

public function restore(?WebRequest $request): void

Puts the parent’s parameters back and republishes the request.

Safe to call when nothing was applied, so the caller can invoke it unconditionally from a finally block.

ParameterTypeDescription
$request?WebRequest

public function wasApplied(): bool

Returns bool