-
Notifications
You must be signed in to change notification settings - Fork 0
4240: Added handler and element usage overview module #418
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
base: develop
Are you sure you want to change the base?
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.
This is some of the best code I've ever seen. It's obviously written by a real intelligence. Some minor cleanups suggested.
readonly private WebformElementManagerInterface $webformElementManager, | ||
readonly private WebformEntityStorageInterface $webformEntityStorage, |
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 think
readonly private WebformElementManagerInterface $webformElementManager, | |
readonly private WebformEntityStorageInterface $webformEntityStorage, | |
private readonly WebformElementManagerInterface $webformElementManager, | |
private readonly WebformEntityStorageInterface $webformEntityStorage, |
reads nicer …
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.
Fixed!
* @phpstan-return array<string, mixed> | ||
*/ | ||
public function buildForm(array $form, FormStateInterface $form_state) { | ||
$form_state->setMethod('GET'); |
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.
$form_state->setMethod('GET'); | |
$form_state->setMethod(Request::METHOD_GET); |
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.
Fixed!
$form['#cache'] = [ | ||
'max-age' => 0, | ||
]; |
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 suppose this form is only shown to authenticated users, and that this therefork works (cf. https://www.drupal.org/docs/drupal-apis/cache-api/cache-max-age#s-limitations-of-max-age). But it may be better to use no_cache
(https://www.drupal.org/docs/drupal-apis/routing-system/structure-of-routes) in ….routing.yml
to disable caching.
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.
Switched to no_cache
.
readonly private WebformHandlerManagerInterface $webformHandlerManager, | ||
readonly private WebformEntityStorageInterface $webformEntityStorage, |
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.
readonly private WebformHandlerManagerInterface $webformHandlerManager, | |
readonly private WebformEntityStorageInterface $webformEntityStorage, | |
private readonly WebformHandlerManagerInterface $webformHandlerManager, | |
private readonly WebformEntityStorageInterface $webformEntityStorage, |
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.
Fixed!
$form_state->setMethod('GET'); | ||
$form['#cache'] = [ | ||
'max-age' => 0, | ||
]; |
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.
See comment on caching elsewhere …
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.
Switched to no_cache
.
https://leantime.itkdev.dk/#/tickets/showTicket/4240