You are here

public function CustomerInfo::buildForm in Ubercart 8.4

Form constructor.

Parameters

\Drupal\uc_order\OrderInterface $order: The order that is being viewed.

array $form: An array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides EditableOrderPanePluginInterface::buildForm

File

uc_order/src/Plugin/Ubercart/OrderPane/CustomerInfo.php, line 55

Class

CustomerInfo
Manage the information for the customer's user account.

Namespace

Drupal\uc_order\Plugin\Ubercart\OrderPane

Code

public function buildForm(OrderInterface $order, array $form, FormStateInterface $form_state) {
  $form['order-view-image'] = [
    '#theme' => 'image',
    '#uri' => base_path() . drupal_get_path('module', 'uc_store') . '/images/order_view.gif',
    '#title' => $this
      ->t('Search for an existing customer.'),
    '#alt' => $this
      ->t('Search for an existing customer.'),
    '#attributes' => [
      'id' => 'load-customer-search',
    ],
    '#prefix' => '<div class="order-pane-icons">',
  ];
  $form['menu-customers-image'] = [
    '#theme' => 'image',
    '#uri' => base_path() . drupal_get_path('module', 'uc_store') . '/images/menu_customers_small.gif',
    '#title' => $this
      ->t('Create a new customer.'),
    '#alt' => $this
      ->t('Create a new customer.'),
    '#attributes' => [
      'id' => 'load-new-customer-form',
    ],
    '#suffix' => '</div>',
  ];
  $form['icons'] = [
    '#type' => 'markup',
    '#markup' => '<div id="customer-select"></div>',
  ];
  $form['uid'] = [
    '#type' => 'hidden',
    '#default_value' => $order
      ->getOwnerId(),
  ];
  $form['uid_text'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Customer number'),
    '#default_value' => $order
      ->getOwnerId(),
    '#maxlength' => 10,
    '#size' => 10,
    '#disabled' => TRUE,
  ];
  $form['primary_email'] = [
    '#type' => 'email',
    '#title' => $this
      ->t('E-mail address'),
    '#default_value' => $order
      ->getEmail(),
    '#maxlength' => 64,
    '#size' => 32,
  ];
  return $form;
}