-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 support for global admin extensions via config #6651
Conversation
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.
There is
admins:
specify one or more admin service ids to which the Extension should be added
excludes:
specify one or more admin service ids to which the Extension should not be added (this will prevent it matching
any of the other settings)
extends:
specify one or more classes. If the managed class of an admin extends one of the specified classes the extension
will be added to that admin.
implements:
specify one or more interfaces. If the managed class of an admin implements one of the specified interfaces the
extension will be added to that admin.
instanceof:
specify one or more classes. If the managed class of an admin extends one of the specified classes or is an instance
of that class the extension will be added to that admin.
uses:
Specify one or more traits. If the managed class of an admin uses one of the specified traits the extension will be
added to that admin.
priority:
Can be a positive or negative integer. The higher the priority, the earlier it’s executed.
You should add a description of your new option too.
@@ -516,14 +516,15 @@ public function getConfigTreeBuilder() | |||
|
|||
->arrayNode('extensions') | |||
->useAttributeAsKey('id') | |||
->defaultValue(['admins' => [], 'excludes' => [], 'implements' => [], 'extends' => [], 'instanceof' => [], 'uses' => []]) | |||
->defaultValue([]) |
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.
This config was wrong for many years. If you do not have any extension, you should not register any invalid extension config.
E.g. the 'admins' => []
node tries to register something like this:
sonata_admin:
extensions:
admins: []
The correct config should be something like this:
sonata_admin:
extensions:
app.publish.extension:
global: true
admins:
- app.admin.article
implements:
- App\Publish\PublishStatusInterface
excludes:
- app.admin.blog
- app.admin.news
extends:
- App\Document\Blog
instanceof:
- App\Document\Page
uses:
- App\Trait\Timestampable
b8ea221
to
4757783
Compare
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.
Now I understand what's doing this global
options, do we need it ?
It can be done with
implements:
- Sonata\AdminBundle\Admin\AdminInterface
isn't it ?
Ok, if I understand, this option already exists but was not usable in the config. |
No
My idea is to allow all options for the config and and tags. |
Thanks @core23 😍 |
Subject
Is is now possible to register a global admin extension via the configuration. This was only possible for tags.
The next step (new PR) is to allow all extension configuration for tags.
I am targeting this branch, because this feature is BC.
Changelog