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

Allow multiple disable option conditions #15290

Merged

Conversation

Abdulmajeed-Jamaan
Copy link
Contributor

@Abdulmajeed-Jamaan Abdulmajeed-Jamaan commented Jan 8, 2025

Description

I have the following use case: repeater that has Select column and RichEditor which used to select a locale and sets its content.

I want to use the disableOptionsWhenSelectedInSiblingRepeaterItems to make it unique, and add extra condition to disable a specific locale from being selected by user but displayable if exists (ai generated content, which has specific locale identifier).

In other words, i need extra condition on top of disableOptionsWhenSelectedInSiblingRepeaterItems.

Functional changes

Modified the trait CanDisableOptions to have similar structure as the HasExtraAttributes which allows multiple conditions to be added optionally.

->disableOptionsWhenSelectedInSiblingRepeaterItems()
->disableOptionWhen(fn(string $value): bool => str($value)->contains('ai'), true)
  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@Abdulmajeed-Jamaan
Copy link
Contributor Author

Would like to learn if there are other proper ways to solve my use case. Or should i proceed with updating the docs ?

@danharrin danharrin added the enhancement New feature or request label Jan 9, 2025
@danharrin danharrin added this to the v3 milestone Jan 9, 2025
@danharrin danharrin merged commit cf5c208 into filamentphp:3.x Jan 9, 2025
10 checks passed
@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
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants