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

Update CanBeHidden traits for a more consistent implementation everywhere #1383

Merged
merged 10 commits into from Jan 31, 2022

Conversation

ralphjsmit
Copy link
Contributor

I just noticed that the CanBeHidden traits do not share the same implementation everywhere. For example, I wanted to dynamically determine whether to display ButtonAction A or B.

To fix that, I copied over the IMO best implementation of CanBeHidden, which is the implementation that offers both the hidden() and visible() methods.

For the page actions there wasn't a way to evaluate closures yet, so I added an EvaluatesClosures trait as well for the page actions. I saw that a page action also had a BelongsToLivewire trait that exposes a getLivewire() method. I used that method to add a $livewire parameter to the EvaluatesClosures trait. I couldn't think of a use case for that, but I though that it couldn't do any harm either.

@danharrin danharrin added the enhancement New feature or request label Jan 30, 2022
@danharrin
Copy link
Member

danharrin commented Jan 30, 2022

Hey, the visible() additions are fine here, but theres no need to accept a closure on pages - you can just use $this to access the LW component.

@danharrin danharrin marked this pull request as draft January 30, 2022 10:52
@ralphjsmit ralphjsmit marked this pull request as ready for review January 31, 2022 07:42
@ralphjsmit
Copy link
Contributor Author

Hey, thanks for the feedback! I updated the PR and removed the Closure support from the page actions component.

@danharrin danharrin merged commit 4d68261 into filamentphp:2.x Jan 31, 2022
@danharrin
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants