I'm using the documentation example. For some reason, I cannot get the custom pane to display in the checkout.
What am I missing?
I'm using the latest version of Drupal Commerce and Drupal 9.2.
namespace Drupal\my_checkout_pane\Plugin\Commerce\CheckoutPane;
use Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a custom message pane.
*
* @CommerceCheckoutPane(
* id = "my_checkout_pane_custom_message",
* label = @Translation("Custom message"),
* display_label = @Translation("Another display label"),
* default_step = "review",
* wrapper_element = "fieldset",
* )
*/
class CustomMessagePane extends CheckoutPaneBase {
/**
* {@inheritdoc}
*/
public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
$form_display = EntityFormDisplay::collectRenderDisplay($this->order, 'checkout');
$form_display->buildForm($this->order, $pane_form, $form_state);
return $pane_form;
}
/**
* {@inheritdoc}
*/
public function validatePaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form) {
$form_display = EntityFormDisplay::collectRenderDisplay($this->order, 'checkout');
$form_display->extractFormValues($this->order, $pane_form, $form_state);
$form_display->validateFormValues($this->order, $pane_form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitPaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form) {
$form_display = EntityFormDisplay::collectRenderDisplay($this->order, 'checkout');
$form_display->extractFormValues($this->order, $pane_form, $form_state);
}
}