You are here

function commerce_backoffice_order_entity_view in Commerce Backoffice 7

Implements hook_entity_view().

File

./commerce_backoffice_order.module, line 131

Code

function commerce_backoffice_order_entity_view($entity, $entity_type, $view_mode, $langcode) {
  if ($entity_type == 'commerce_order' && in_array($view_mode, array(
    'administrator',
    'backoffice',
  ))) {
    $status_form = drupal_get_form('commerce_backoffice_order_status_form', $entity);

    // Bubble-up the signal for refreshing the parent row.
    if (!empty($status_form['#megarow_refresh_parent'])) {
      $entity->content['#megarow_refresh_parent'] = TRUE;
    }
    $markup = '<div class="field commerce-backoffice-order-status-form">';
    $markup .= '<div class="commerce-backoffice-order-status-label">' . t('Order status') . '</div>';
    $markup .= drupal_render($status_form);
    $markup .= '</div>';
    $entity->content['status'] = array(
      '#weight' => 10,
      '#markup' => $markup,
      '#access' => commerce_order_access('update', $entity),
    );
  }
}