-
-
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
Set subject on admin instance when extracting translatable strings #6224
Set subject on admin instance when extracting translatable strings #6224
Conversation
What about creating a simple Admin with that configuration and then check the catalogue? To reflect the reason why this is changed. |
I think it will take quite a bit of code to come up with a valid use case for having a subject in configureForm for instance. Do you have a suggestion? |
You mean something like ?
|
6b5f1ff
to
4d84229
Compare
Thank you @jorrit |
Thanks for merging. I hadn't actually added a test as suggested by @franmomu. I have tried, but it is quite hard in this test class to use a concrete admin class as the methods that are called by the extractor need a lot of dependencies. |
No problem, I'll try now with a functional test. |
@@ -121,4 +121,18 @@ public function testExtractCallsBreadcrumbs(): void | |||
|
|||
$this->adminExtractor->extract([], $catalogue); | |||
} | |||
|
|||
public function testExtractSetsSubject(): void |
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.
I saw this test and I thought that was the requested one @jorrit . Should we revert?
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.
No, don't worry, I added one in #6237
Subject
After #6040 was added commands like
php bin/console debug:translation
execute methods on Admin class instances to extract translatable strings.One of the methods is
getForm
, which callsconfigureFormFields
. To tailor my forms I access$this->getSubject()
in several of these methods. I hope this is not unusual or against best practices.When the AdminExtractor calls
getForm()
no subject is present.I added this code to make sure a basic model is available:
I am targeting this branch, because it is backwards compatible.
Closes #6221.
Changelog