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

Add option to configure actions of FormField / Panel #3557

Open
wants to merge 3 commits into
base: 4.x
Choose a base branch
from

Conversation

lukasluecke
Copy link
Contributor

Resolves #3519.

FormField::addPanel('Identität')
    ->configureActions(fn(Actions $actions) => $actions
        ->add(Crud::PAGE_DETAIL, Action::new('another', 'Another')->linkToUrl('...')->addCssClass('btn btn-secondary'))
        ->add(Crud::PAGE_DETAIL, Action::new('test', 'Test', 'fa fa-home')->linkToUrl('...')->addCssClass('btn btn-link'))
    )

CleanShot 2020-07-14 at 15 33 58@2x

@lukasluecke lukasluecke changed the title Add configureActions to FormField / Panel Add option to configure actions of FormField / Panel Jul 14, 2020
@javiereguiluz javiereguiluz added this to the 3.x milestone Jul 15, 2020
@@ -40,7 +44,9 @@ public static function addPanel(?string $label = null, ?string $icon = null): se
->setFormTypeOptions(['mapped' => false, 'required' => false])
->setCustomOption(self::OPTION_ICON, $icon)
->setCustomOption(self::OPTION_COLLAPSIBLE, false)
->setCustomOption(self::OPTION_COLLAPSED, false);
->setCustomOption(self::OPTION_COLLAPSED, false)
->setCustomOption(self::OPTION_ICON, null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a typo, a line too much.

@michaelKaefer
Copy link
Contributor

Nice feature!

Since this PR new methods were implemented: FormField::addRow and FormField::addTab, so I'm not sure if the it should be changed to:

FormField::addPanel(
    'Identität',
    null,
    fn(Actions $actions) => $actions->add(Crud::PAGE_DETAIL, Action::new('another', 'Another')->linkToUrl('...')->addCssClass('btn btn-secondary')))
;

Or how can we limit it to panels (excluding rows and tabs) in another way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[3.x] Allow adding actions (links / buttons) to Panels
4 participants