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

Support additional repeater and builder actions #8461

Conversation

yassine-kessal
Copy link
Contributor

This PR adds the possibility of setting custom actions in the form's reapter field (other than predefined add, clone, etc. actions), using the repeater's registerActions method, example :

Repeater::make('fields')
      ->collapsible()
      ->reorderableWithButtons()
      ->itemLabel(fn (array $state): ?string => $state['name'] ?? null)
      ->columns(2)
      ->registerActions([
          Action::make('field-settings')
              ->icon('heroicon-o-cog')
              ->iconButton(),
          Action::make('copy')
              ->icon('heroicon-o-clipboard')
              ->iconButton(),
      ]);

Preview :
image

  • Changes have been thoroughly tested to not break existing functionality.
  • New functionality has been documented or existing documentation has been updated to reflect changes.
  • Visual changes are explained in the PR description using a screenshot/recording of before and after.

@danharrin danharrin added enhancement New feature or request low priority labels Sep 14, 2023
@danharrin danharrin added this to the v3 milestone Sep 14, 2023
@yassine-kessal
Copy link
Contributor Author

yassine-kessal commented Sep 16, 2023

Oupps sorry for commits sync on this branch, let me know if you want me to recreate the PR.

@yassine-kessal
Copy link
Contributor Author

A little commit to add this feature for Builder form component and be more consistent.

@zepfietje zepfietje changed the title Feature : Custom actions for form repeater field Support additional repeater and builder actions Sep 19, 2023
@danharrin danharrin changed the base branch from 3.x to 3.1 October 31, 2023 08:55
@danharrin danharrin merged commit 60e8651 into filamentphp:3.1 Oct 31, 2023
2 of 4 checks passed
@danharrin danharrin modified the milestones: v3, v3.1 Oct 31, 2023
@tonypartridger
Copy link
Contributor

Thoughts on adding support to builder blocks too?

@danharrin
Copy link
Member

This PR covers repeater and builder header actions.

@tonypartridger
Copy link
Contributor

This PR covers repeater and builder header actions.

It sure does, but unless I am missing something it doesn't cover Builder 'Block' actions.

@danharrin
Copy link
Member

I do not understand what a block action is, compared to a header action.

@tonypartridger
Copy link
Contributor

I do not understand what a block action is, compared to a header action.

No problem, please see attached.
Screenshot 2023-12-11 at 09 23 44

@danharrin
Copy link
Member

its a header action

@tonypartridger
Copy link
Contributor

its a header action

It's a header action of the builder block type yep. This PR only supports header actions on the repeater and the builder header actions not the builder block header actions as far as I can tell.

I am asking what your thoughts are on adding it to the Builder Block Header Actions too.

@danharrin
Copy link
Member

in your screenshot, they both look like extraItemActions() that are possible in this PR

@tonypartridger
Copy link
Contributor

See attached the Builder\Block does not support extraItemActions. This is what I was suggesting we expand support to.

Screenshot 2023-12-11 at 09 54 30

@danharrin
Copy link
Member

So are you asking for block-specific actions that are not added to every block type at once? Because they would look the same as the current solution

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

Successfully merging this pull request may close these issues.

None yet

3 participants