Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Adds a section for order notes.
- *
- * @CommerceCheckoutPane(
- * id = "order_notes",
- * label = @Translation("Order notes"),
- * default_step = "order_information",
- * )
- */
- class OrderNotes extends CheckoutPaneBase implements CheckoutPaneInterface {
- /**
- * The inline form manager.
- *
- * @var DrupalcommerceInlineFormManager
- */
- protected $inlineFormManager;
- /**
- * {@inheritdoc}
- */
- public function __construct(array $configuration, $plugin_id, $plugin_definition, CheckoutFlowInterface $checkout_flow, EntityTypeManagerInterface $entity_type_manager) {
- parent::__construct($configuration, $plugin_id, $plugin_definition, $checkout_flow, $entity_type_manager);
- }
- /**
- * {@inheritdoc}
- */
- public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
- $pane_form['order_notes'] = [
- '#type' => 'textarea',
- '#title' => $this->t('Order notes'),
- '#default_value' => $this->order->get('field_order_notes')->getString(),
- '#required' => FALSE,
- ];
- return $pane_form;
- }
- /**
- * {@inheritdoc}
- */
- public function submitPaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form) {
- $values = $form_state->getValue($pane_form['#parents']);
- $this->order->set('field_order_notes', $values);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement