We have the get_context_with_post and get_context_with_posts helpers, but it'd be nice to have a helper for setting arbitrary data:
$data = $site->context([
'post' => new Post(),
'thingy' => new Thingy(),
]);
This is more flexible and can subsume the get_context_with_post[s] methods, which should probably be deprecated.
Acceptance criteria:
[x] a new method with the signature context(array $with) : array on the Conifer\Site class, which returns Timber::get_context() merged with the values in the $with data
[x] deprecated notices and doc tags on both get_context_with_post[s] methods (example from the Timber codebase here)
We have the
get_context_with_post
andget_context_with_posts
helpers, but it'd be nice to have a helper for setting arbitrary data:This is more flexible and can subsume the
get_context_with_post[s]
methods, which should probably be deprecated.Acceptance criteria:
context(array $with) : array
on theConifer\Site
class, which returnsTimber::get_context()
merged with the values in the$with
dataget_context_with_post[s]
methods (example from the Timber codebase here)