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

Share conditional action logic via trait #15948

Merged
merged 4 commits into from
Oct 23, 2024
Merged

Conversation

timkelty
Copy link
Contributor

@timkelty timkelty commented Oct 23, 2024

Description

Shares logic for conditionally applying a filter.

  • Splits \craft\filters\UtilityAccess::when logic into its own ConditionalFilterTrait
  • Drops SiteFilterTrait::enabled in favor of ConditionalFilterTrait::when
  • Types ConditionalFilterTrait::when as ?Closure instead of mixed
  • Moves logic into isActive instead of beforeAction
  • Example has been updated to use when syntax

Related issues

@timkelty timkelty changed the base branch from 4.x to 4.13 October 23, 2024 02:41
@brandonkelly brandonkelly merged commit 701f159 into 4.13 Oct 23, 2024
@brandonkelly brandonkelly deleted the feature/conditional-filters branch October 23, 2024 14:56
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.

2 participants