This PR adds the ability to set titles using closures when using the functional API.
As of 1.5.0 it's not possible to make "computed" titles using the functional API. To achieve this, the class-based API has to be used using the rendering lifecycle hook as described in the Volt documentation.
By allowing closures to be passed to the title function it will allow developers to defined titles like so:
state(['firstName' => 'Tom']);
title(fn () => 'This is the title');
// Or even
title(fn () => "Hi $this->firstName");
This PR adds the ability to set titles using closures when using the functional API.
As of 1.5.0 it's not possible to make "computed" titles using the functional API. To achieve this, the class-based API has to be used using the
rendering
lifecycle hook as described in the Volt documentation.By allowing closures to be passed to the
title
function it will allow developers to defined titles like so:I will submit a separate PR for documentation.