Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. /**
  2. * Adds a section for order notes.
  3. *
  4. * @CommerceCheckoutPane(
  5. * id = "order_notes",
  6. * label = @Translation("Order notes"),
  7. * default_step = "order_information",
  8. * )
  9. */
  10. class OrderNotes extends CheckoutPaneBase implements CheckoutPaneInterface {
  11. /**
  12. * The inline form manager.
  13. *
  14. * @var DrupalcommerceInlineFormManager
  15. */
  16. protected $inlineFormManager;
  17. /**
  18. * {@inheritdoc}
  19. */
  20. public function __construct(array $configuration, $plugin_id, $plugin_definition, CheckoutFlowInterface $checkout_flow, EntityTypeManagerInterface $entity_type_manager) {
  21. parent::__construct($configuration, $plugin_id, $plugin_definition, $checkout_flow, $entity_type_manager);
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
  27. $pane_form['order_notes'] = [
  28. '#type' => 'textarea',
  29. '#title' => $this->t('Order notes'),
  30. '#default_value' => $this->order->get('field_order_notes')->getString(),
  31. '#required' => FALSE,
  32. ];
  33. return $pane_form;
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function submitPaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form) {
  39. $values = $form_state->getValue($pane_form['#parents']);
  40. $this->order->set('field_order_notes', $values);
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement