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

[Example] Add custom toolbar action to form view #82

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

niklasnatter
Copy link
Contributor

@niklasnatter niklasnatter commented Nov 2, 2020

What's in this PR?

This PR demonstrates how to add a custom toolbar action to a form view of the administration interface of Sulu. The example adds a simple app.generate_name toolbar action for inserting a random name to the add contact form view.

Screenshot 2020-10-07 at 15 58 16

To apply the changes, the administration frontend application needs to be rebuilt by executing bin/console sulu:admin:update-build.

@niklasnatter niklasnatter added the Example Example implementations label Nov 9, 2020
return {
type: 'button',
label: translate('app.generate_name'),
icon: 'su-magic',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Available icons are documented in the Sulu Javascript Docs.

{
public function configureViews(ViewCollection $viewCollection): void
{
if ($viewCollection->has('sulu_contact.contact_add_form.details')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will add the toolbar action to the form for creating new contacts only. It will not affect the form for editing existing contacts.

@niklasnatter niklasnatter force-pushed the example/custom-form-toolbar-action branch from 596fde8 to 106390a Compare June 20, 2022 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Example Example implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant