ButtonCollectionType

ButtonCollectionType is a form type used to group buttons in a common form group, which is useful for forms that have multiple submit buttons.

Type options

Option Type Default value Description
label boolean false
name string ``
justify_content string space-between
buttons array []

Code example

$builder->add('actions', ButtonCollectionType::class, [
    'buttons' => [
        'edit' => [
            'type' => IconButtonType::class,
            'options' => [
                'icon' => 'mode_edit',
                'attr' => [
                    'class' => 'edit-combination-item tooltip-link',
                    'data-toggle' => 'pstooltip',
                    'data-original-title' => $this->trans('Edit', 'Admin.Actions'),
                ],
            ],
        ],
        'delete' => [
            'type' => IconButtonType::class,
            'options' => [
                'icon' => 'delete',
                'attr' => [
                    'class' => 'delete-combination-item tooltip-link',
                    'data-modal-title' => $this->trans('Delete item', 'Admin.Notifications.Warning'),
                    'data-modal-message' => $this->trans('Delete selected item?', 'Admin.Notifications.Warning'),
                    'data-modal-apply' => $this->trans('Delete', 'Admin.Actions'),
                    'data-modal-cancel' => $this->trans('Cancel', 'Admin.Actions'),
                    'data-toggle' => 'pstooltip',
                    'data-original-title' => $this->trans('Delete', 'Admin.Actions'),
                ],
            ],
        ],
    ],
    'label' => $this->trans('Actions', 'Admin.Global'),
    'attr' => [
        'class' => 'combination-row-actions',
    ],
])

Preview example

ButtonCollectionType rendered in form example