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

allowing to add a closure to handle visibility for some actions #15151

Closed

Conversation

ht3aa
Copy link

@ht3aa ht3aa commented Dec 20, 2024

Description

Problem: can't control the visibility of some actions in repeater form field without using the (deleteAction, addAction...) methods. also the ($state) of each item isn't evaluated like other fields as expected.

Solution: adding ability to pass a Closure to visibility method for actions

  • add action
  • add between action
  • delete action
  • clone action
  • move down action
  • move up action
  • reorder action

and evaluate the state to directly get the state of the item using
$state[$arguments['item']]

Visual changes

here are some photos for delete action

before:
Screenshot from 2024-12-20 13-50-14

after:
Screenshot from 2024-12-20 13-51-23

Functional changes

  • 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.

@danharrin
Copy link
Member

Hi, apologies but we are no longer accepting new features for v3 as per #13744. Also, please check out our contributing guide which talks about proposing the feature before submitting the PR, to ensure you aren't spending time building something that we won't merge.

In this case, I would not like to merge this since it is already possible by overriding the action method and passing ->hidden(), as you said in the original PR. If we added customisation methods for every since action on the repeater too, it would get out of hand, which is why we have the generalised functions for modifying the Action object.

@danharrin danharrin closed this Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants