#[Context]

Attribute on parameters.

use Saij\WpAppFramework\Block\Context;

Marks a parameter of render() that receives the value of an attribute an ancestor block provides (#[ProvidesContext]). The parameter has the type of that attribute; it keeps its default (or null) if no ancestor provides the value.

Arguments

#[Context(string $block, string $attribute)]
ParameterTypeDefaultDescription
blockclass-stringrequiredThe providing block of the same theme or plugin.
attributestringrequiredName of the attribute marked with #[ProvidesContext] in its attribute class.