Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Allow setting title using a closure in functional API #79

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

RVxLab
Copy link
Contributor

@RVxLab RVxLab commented Nov 28, 2023

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");

I will submit a separate PR for documentation.

@RVxLab RVxLab changed the title [1.x] Allow setting title using a closure [1.x] Allow setting title using a closure in functional API Nov 28, 2023
@taylorotwell taylorotwell merged commit ba0dcf7 into livewire:main Nov 28, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants