Problem/Motivation
#2987060: Commerce 2 Completion Registration checkout pane introduces the file EmailRegistrationCompletionRegistration.php which uses Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CompletionRegister -- introduced in Commerce 2.12 (#2857157: Implement registration after guest checkout).
If someone tries to use the latest dev branch of email registration with Commerce 2.11 or earlier, the checkout flows completely break and users are unable to checkout.
Given that Email Registration can be used without Commerce - there shouldn't be any functionality included in the base module that requires Commerce.
Proposed resolution
Break out the checkout panes into a submodule.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#14 | email_registration--checkout_pane_submodule--14.patch | 10.58 KB | rwanth |
|
Comments
Comment #2
rwanthComment #3
gregglesThis seems critical, so bumping that and a patch needs review.
Comment #4
gregglesThe issue says:
The code does:
Maybe that should be `(>=8.x-2.12)` or `(>8.x-2.11)` ?
Comment #5
lkacenjaThis looks ready to RTBC to me, but might we name the module something more generic like email_registration_commerce? That way any future non-checkout pane integration could live there too?
Comment #6
rwanth@greggles is correct, it should be >=2.12.
@lkacenja - I thought about that as well, probably a good idea.
Thanks for the feedback! New patch attached.
Comment #7
gregglesThanks for the followup. I added this to #3021912: Plan for creating email registration 8.x-1.0 final stable as it seems important to get done soon. I'd like to get 1.0 done in the next month, for what it's worth.
Comment #8
lkacenjaI could get #6 to apply easily with git apply. However, I've not been able to get it to roll successfully with composer patches (patch). It runs something like:
patch '-p1' --no-backup-if-mismatch < 'email_registration--checkout_pane_submodule--6.patch'
Yields:
It creates those two files, but that's it. I'm sure I'm just doing something goofy, but it would be good to make sure.
Also, I think the namespaces of the two plugins could be adjusted from:
Drupal\email_registration\Plugin\Commerce\CheckoutPane;
to
Drupal\email_registration_commerce\Plugin\Commerce\CheckoutPane;
Otherwise, I think it seems great. Thanks for all the work @rwanth
Comment #9
rwanth@lkacenja, you weren't seeing any file changes with composer because the patch was just renaming the old files to create the submodule. With the namespaces changed in the three relevant files, you should see it all files being modified when applying with composer.
Comment #10
rwanthMissed a namespace change in the body of the tests. This should pass.
Comment #11
rwanthI've found some time to look at this today. It looks like the tests failed because it was unable to load the email registration pane after namespace changes. I'm now fetching the checkout flow by using \Drupal::service('entity_type.manager'), which seems to be working on my end. I made some other minor changes to the test as well.
Edit:
Same errors. I'll have to spend some more time looking at it.
Comment #12
andypostWe should use https://getcomposer.org/doc/04-schema.md#conflict
Like core doing for pathauto https://git.drupalcode.org/project/drupal/blob/8.8.x/core/composer.json#L52
EDIT https://www.drupal.org/project/commerce/releases/8.x-2.12
Comment #13
andypostExtra comma
Comment #14
rwanthApologies it took me a while to get back to this. I've fixed the failing tests and included @andypost's addition to the composer.json.
Comment #15
andypostI really can't get why we need a split for 2 modules?
Summary said the issue because old commerce could try use new code - then right fix in #13
I think let's commit fix for composer and then discuss the split
plugins should not require their modules enabled
.module is not required in d8
totally wrong change, drupal coding standards require FQDN in doc blocks
Comment #17
andypostCommited https://www.drupal.org/commitlog/commit/4278/07e15557c81b0f96899d3168a85...
So the main question do we really need the split? what are pro and contra
Comment #18
rwanthI suppose it is a difference in philosophy. I think that modules should have the minimum required dependencies for the general use-case, and anything optional, like extensions of other contrib modules, should be broken out.
As a whole, the use-case for this module is far more general than Commerce. Since the checkout pane functionality is an extension of Commerce, I think should be compartmentalized from the rest of the module. That way site-builders have the choice to enable and we can indicate dependencies at that time.
(Also, thank you for patch feedback!)
Comment #19
gregglesI was a bit confused on the situation, so I just tested it out.
It seems that Email Registration does not depend on commerce directly, i.e. it does not require a site to install commerce. A better title for the issue as rwanth was working on it might be "Email Registration should not affect Commerce unless configured to do so" and then the solution of splitting it to a module or making the behavior configurable might be worthwhile.
Another perspective on this is that email registration should just do what it can (e.g. the composer change andypost made) to prevent breaking older versions of commerce. I think that's the best solution here so I updated the title and status to match.
I am sorry about the bug with the commerce panes in 2.11. I can definitely see how that would be disorienting to have a completely new feature related to commerce that is enabled by default in an RC release. That's something I'll try to avoid in the future, or maybe call out more explicitly in the upgrade notes.
Comment #20
andypostYep, the whole idea behind d8-plugins is they should not be used without configuration, but module supposed to be pluggable (install/unistall)
So yep, we could make each name/email replacement in forms configurable runtime but it means that some users can bypass module rules and cause a data-mess in names