Skip to content

Share conditional action logic via trait#15948

Merged
brandonkelly merged 4 commits into4.13from
feature/conditional-filters
Oct 23, 2024
Merged

Share conditional action logic via trait#15948
brandonkelly merged 4 commits into4.13from
feature/conditional-filters

Conversation

@timkelty
Copy link
Copy Markdown
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
@timkelty timkelty requested a review from brandonkelly October 23, 2024 02:44
@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