diff --git a/modules/checkout/src/Plugin/Commerce/CheckoutPane/Login.php b/modules/checkout/src/Plugin/Commerce/CheckoutPane/Login.php index a49bf09..0b70248 100644 --- a/modules/checkout/src/Plugin/Commerce/CheckoutPane/Login.php +++ b/modules/checkout/src/Plugin/Commerce/CheckoutPane/Login.php @@ -180,6 +180,11 @@ class Login extends CheckoutPaneBase implements CheckoutPaneInterface, Container * {@inheritdoc} */ public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) { + $panes = $this->checkoutFlow->getPanes(); + $registration_pane = $panes['registration']->getConfiguration()['step'] != '_disabled'; + $proceed_checkout = $this->t('Proceed to checkout.'); + $create_account = $this->t('You can optionally create an account at the end.'); + $pane_form['#attached']['library'][] = 'commerce_checkout/login_pane'; $pane_form['returning_customer'] = [ @@ -233,7 +238,7 @@ class Login extends CheckoutPaneBase implements CheckoutPaneInterface, Container $pane_form['guest']['text'] = [ '#prefix' => '
', '#suffix' => '
', - '#markup' => $this->t('Proceed to checkout. You can optionally create an account at the end.'), + '#markup' => $proceed_checkout . ($registration_pane ? ' ' . $create_account : ''), ]; $pane_form['guest']['continue'] = [ '#type' => 'submit', diff --git a/modules/checkout/src/Plugin/Commerce/CheckoutPane/Registration.php b/modules/checkout/src/Plugin/Commerce/CheckoutPane/Registration.php index 7d84109..1952675 100644 --- a/modules/checkout/src/Plugin/Commerce/CheckoutPane/Registration.php +++ b/modules/checkout/src/Plugin/Commerce/CheckoutPane/Registration.php @@ -220,4 +220,21 @@ class Registration extends CheckoutPaneBase implements CheckoutPaneInterface, Co ]); } + /** + * {@inheritdoc} + */ + public function setStepId($step_id) { + if ($step_id == '_disabled') { + $this->configuration['step'] = $step_id; + } + else { + $this->configuration['step'] = 'complete'; + if ($step_id != 'complete') { + drupal_set_message($this->t('The %label pane can only be used on the "Complete" step.', [ + '%label' => $this->getLabel(), + ]), 'warning'); + } + } + } + }