/** * {@inheritdoc} */ public function buildForm(OrderInterface $order, array $form, FormStateInterface $form_state) { $form['order-view-image'] = array('#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' => array('id' => 'load-customer-search'), '#prefix' => '<div class="order-pane-icons">'); $form['menu-customers-image'] = array('#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' => array('id' => 'load-new-customer-form'), '#suffix' => '</div>'); $form['icons'] = array('#type' => 'markup', '#markup' => '<div id="customer-select"></div>'); $form['uid'] = array('#type' => 'hidden', '#default_value' => $order->getOwnerId()); $form['uid_text'] = array('#type' => 'textfield', '#title' => $this->t('Customer number'), '#default_value' => $order->getOwnerId(), '#maxlength' => 10, '#size' => 10, '#disabled' => TRUE); $form['primary_email'] = array('#type' => 'email', '#title' => $this->t('E-mail address'), '#default_value' => $order->getEmail(), '#maxlength' => 64, '#size' => 32); return $form; }
/** * {@inheritdoc} */ public function view(OrderInterface $order, $view_mode) { if ($view_mode == 'customer' && $order->access('invoice')) { $build = array('#type' => 'link', '#title' => $this->t('Click to open a window with a printable invoice.'), '#url' => Url::fromRoute('uc_order.user_invoice_print', ['user' => $order->getOwnerId(), 'uc_order' => $order->id()], array('attributes' => array('onclick' => "window.open(this.href, '" . $this->t('Invoice') . "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=480,left=50,top=50'); return false;")))); return $build; } }
/** * {@inheritdoc} */ public function buildForm(OrderInterface $order, array $form, FormStateInterface $form_state) { $pane = $this->pluginDefinition['id']; // Need to pass along uid, address pane selector, and pane id for use in the JavaScript. $form['#attached']['drupalSettings'] = array('uid' => $order->getOwnerId(), 'paneId' => '#' . $pane . '-address-select', 'addressType' => $pane); $form['address-book-image'] = array('#theme' => 'image', '#uri' => base_path() . drupal_get_path('module', 'uc_store') . '/images/address_book.gif', '#title' => $this->t('Select from address book.'), '#alt' => $this->t('Select from address book.'), '#attributes' => array('class' => 'load-address-select'), '#prefix' => '<div class="order-pane-icons">'); $form['copy-address-image'] = array('#theme' => 'image', '#uri' => base_path() . drupal_get_path('module', 'uc_store') . '/images/copy.gif', '#suffix' => '</div>'); // An empty <div> to put our address book select into. // @todo: This can be done with core Ajax. $form['icons'] = array('#type' => 'markup', '#markup' => '<div id="' . $pane . '-address-select"></div>'); $form['address'] = array('#type' => 'uc_address', '#parents' => [$pane], '#default_value' => $order->getAddress($pane), '#required' => FALSE); return $form; }