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

Allow admin extension to configure admin at initialize time #7144

Merged
merged 4 commits into from
May 2, 2021
Merged

Allow admin extension to configure admin at initialize time #7144

merged 4 commits into from
May 2, 2021

Conversation

yann-eugone
Copy link
Contributor

@yann-eugone yann-eugone commented May 1, 2021

Subject

Allow admin to be configured by extensions at initialize time.

I am targeting this branch, because code is backwards compatible.

Closes #6890.

Changelog

### Added
- Added `AdminExtensionInterface::configure` method
- Added `AbstractAdminExtension::configure` method with no content

### Changed
- Changed `AbstractAdmin::initialize` and call `AdminExtensionInterface::configure` on each extension

To do

  • Update the documentation;

@yann-eugone yann-eugone requested a review from VincentLanglet May 1, 2021 13:58
@yann-eugone yann-eugone requested a review from VincentLanglet May 1, 2021 14:50
@VincentLanglet VincentLanglet added this to the 4.0 milestone May 1, 2021
@yann-eugone yann-eugone requested a review from dmaicher May 2, 2021 07:42
@VincentLanglet VincentLanglet requested a review from a team May 2, 2021 09:38
* Get a chance to configure admin before used.
*
* @phpstan-param AdminInterface<T> $admin
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

we could also add // NEXT_MAJOR: Uncomment this method

Copy link
Member

Choose a reason for hiding this comment

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

I will uncomment this during the merge

@VincentLanglet VincentLanglet merged commit f347a79 into sonata-project:3.x May 2, 2021
@rande
Copy link
Member

rande commented May 3, 2021

@VincentLanglet @dmaicher if this is used to generate routes, this might lead to unexpected behaviour as Symfony will store the route in a cached file. This file will not change even if you add custom rules at runtime to alter routes.

@VincentLanglet
Copy link
Member

I don't expect people to use it like this.
I assume it doesn't work either to override the configure method of the Admin class in order to generate routes ? So I would say, you can only do in the configure method of the AdminExtension the same thing you can do in the configure method of the Admin class.

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.

Allow admin extension to define templates
4 participants