-
Notifications
You must be signed in to change notification settings - Fork 42
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] Modify list and form of built-in category entity #92
base: master
Are you sure you want to change the base?
Conversation
f8cd428
to
b72662e
Compare
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/form-1.0.xsd" | ||
> | ||
<key>category_details</key> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sulu automatically merges form-configurations that use the same key. This allows to hide existing properties and display new properties in existing forms.
To use this mechanism with form-configurations that include <section>
tags, the workaround described in sulu/sulu#5570 might be helpful.
Be aware that newly added properties need to be persisted to the database and included in the responses of the respective API endpoints. For example, this is possible by implementing an event subscriber similar to the CategoryEventSubscriber
in this PR.
@@ -0,0 +1,13 @@ | |||
<?xml version="1.0" ?> | |||
<list xmlns="http://schemas.sulu.io/list-builder/list"> | |||
<key>categories</key> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sulu automatically merges list-configurations that use the same key. This allows to hide existing properties and display new properties in existing lists.
b72662e
to
1eb2fb6
Compare
1eb2fb6
to
0a8cca3
Compare
Hello, |
You can get this by passing additional data to the controller. |
Thanks a lot! It would be quite interesting to know how to access the new |
What's in this PR?
This PR demonstrates how to modify the list view and the form view of the the built-in category entity. The example hides the
key
property and adds an additionalcolor
property to the list view and form view of the category entity.To implement the
color
property, the PR extends the category entity and adds a Symfony event listener to persist and serialize the data of the new property.To apply the changes, the schema of the database needs to be updated by executing
bin/console doctrine:schema:update --force
.