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

Move form definition retrieval out of controller constructors for proper access checking in other contexts #19

Merged
merged 3 commits into from
Jan 19, 2024

Conversation

jensschuppe
Copy link
Collaborator

Fixes #14. Replaces #15.

This is a more comprehensive approach to moving form definition retrieval out of controller constructors.

The \Drupal\civiremote_event\Controller\RegisterFormController class now responds to all registration-related routes (register, update, cancel) and includes a combined access check that can be used reliably outside of those route contexts (e.g. when validating a URL for displaying on another page).

Also, retrieving the form definition is now done in a centralized controller method before handing things off to the respective form builders, which do not have to care for initializing things in their constructor anymore. This also prevents intermittent error messages be displayed for errors during route access checks.

@FeyP Would you be able to give this a try and leave a review?

@jensschuppe
Copy link
Collaborator Author

@dontub if you have time, could you have a look as well? Also, the PHPStan jobs are failing due to failing GitHub authentication …

@jensschuppe
Copy link
Collaborator Author

Thanks @dontub I did the changes you requested in 41052ad - care to have a quick look again?

@jensschuppe jensschuppe merged commit 2a34073 into 1.1.x Jan 19, 2024
8 of 14 checks passed
@jensschuppe jensschuppe deleted the formControllerRefactoring branch January 19, 2024 14:33
@jensschuppe jensschuppe added status:fixed The issue has been resolved (usually by committing/merging code) and removed status:needs review Code needs review and testing labels Jan 19, 2024
@jensschuppe
Copy link
Collaborator Author

This introduced a regression causing all forms for all contexts (create, update, cancel) to use the RegisterForm form builder class instead of the resprective subclasses. #24 fixes that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request status:fixed The issue has been resolved (usually by committing/merging code)
Projects
None yet
2 participants