Commit 38222df7 authored by Jonathan Sacksick's avatar Jonathan Sacksick Committed by Jonathan Sacksick
Browse files

Issue #3314776 by jsacksick, rszrama: Synchronize the order admin view page...

Issue #3314776 by jsacksick, rszrama: Synchronize the order admin view page and edit form meta regions.
parent 15f0ed81
Loading
Loading
Loading
Loading
+9 −1
Changes for modules/order/commerce_order.module: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -158,9 +158,17 @@ function template_preprocess_commerce_order(array &$variables) {
  }
  // Inject order fields not manually printed in a separate variable for easier
  // rendering.
  if (in_array($view_mode, ['user', 'admin'])) {
  if (in_array($view_mode, ['user', 'admin'], TRUE)) {
    $printed_fields = ['order_items', 'total_price', 'activity', 'completed', 'placed', 'changed', 'uid', 'mail', 'ip_address', 'billing_information', 'shipping_information', 'state', 'balance'];
    $variables['additional_order_fields'] = array_diff_key($variables['order'], array_combine($printed_fields, $printed_fields));

    if ($view_mode === 'admin') {
      // Show the order's store only if there are multiple available.
      /** @var \Drupal\commerce_store\StoreStorageInterface $store_storage */
      $store_storage = \Drupal::entityTypeManager()->getStorage('commerce_store');
      $store_query = $store_storage->getQuery()->accessCheck(TRUE);
      $variables['stores_count'] = (int) $store_query->count()->execute();
    }
  }

  if ($billing_profile = $order->getBillingProfile()) {
+8 −1
Changes for modules/order/config/install/core.entity_view_display.commerce_order.default.default.yml: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -82,6 +82,14 @@ content:
      use_modal: true
    third_party_settings: {  }
    region: content
  store_id:
    type: entity_reference_label
    label: inline
    settings:
      link: true
    third_party_settings: {  }
    weight: 5
    region: content
  total_price:
    type: commerce_order_total_summary
    weight: 1
@@ -99,5 +107,4 @@ content:
hidden:
  billing_profile: true
  order_number: true
  store_id: true
  total_paid: true
+1 −1
Changes for modules/order/src/Form/OrderForm.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ class OrderForm extends ContentEntityForm {
        '#access' => empty($form['store_id']),
      ],
      'date' => NULL,
      'changed' => $this->fieldAsReadOnly($this->t('Last saved'), $last_saved),
      'changed' => $this->fieldAsReadOnly($this->t('Changed'), $last_saved),
    ];
    $form['customer'] = [
      '#type' => 'details',
+5 −0
Changes for modules/order/templates/commerce-order--admin.html.twig: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -44,6 +44,11 @@
            </div>
          {% endif %}
        {% endfor %}
        {% if stores_count > 1 and order.store_id %}
          <div class="form-item">
            {{ order.store_id }}
          </div>
        {% endif %}
        {% if order.balance %}
          <div class="form-item">
            {{ order.balance }}