Projet

Général

Profil

Paste
Télécharger (2,11 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / commerce / modules / order / includes / commerce_order_ui.orders.inc @ b858700c

1
<?php
2

    
3
/**
4
 * @file
5
 * Page callbacks and form builder functions for administering orders.
6
 */
7

    
8

    
9
/**
10
 * Form callback: edit the global order settings.
11
 */
12
function commerce_order_settings_form($form, &$form_state) {
13
  $form['commerce_order_help_text'] = array(
14
    '#type' => 'textarea',
15
    '#title' => t('Order creation help text'),
16
    '#description' => t('Supply an optional help message to be displayed above the order add form.'),
17
    '#default_value' => variable_get('commerce_order_help_text', ''),
18
    '#weight' => -10,
19
  );
20
  $form['commerce_order_auto_revision'] = array(
21
    '#type' => 'checkbox',
22
    '#title' => t('Create new revisions when orders are updated by default.'),
23
    '#description' => t('This default may be overridden on the order edit form but will always be respected for other order status updates.'),
24
    '#default_value' => variable_get('commerce_order_auto_revision', TRUE),
25
    '#weight' => 0,
26
  );
27

    
28
  return system_settings_form($form);
29
}
30

    
31
/**
32
 * Form callback wrapper: create or edit an order.
33
 *
34
 * @param $order
35
 *   The order object to edit through the form.
36
 * @param $account
37
 *   For new orders, the customer's user account.
38
 *
39
 * @see commerce_order_order_form()
40
 */
41
function commerce_order_ui_order_form_wrapper($order, $account = NULL) {
42
  // Set the page title and a default customer if necessary.
43
  if (empty($order->order_id)) {
44
    drupal_set_title(t('Create an order'));
45

    
46
    if (!empty($account)) {
47
      $order->uid = $account->uid;
48
    }
49
  }
50

    
51
  // Include the forms file from the Order module.
52
  module_load_include('inc', 'commerce_order', 'includes/commerce_order.forms');
53
  return drupal_get_form('commerce_order_ui_order_form', $order);
54
}
55

    
56
/**
57
 * Form callback wrapper: confirmation form for deleting an order.
58
 *
59
 * @param $order
60
 *   The order object to delete through the form.
61
 *
62
 * @see commerce_order_order_delete_form()
63
 */
64
function commerce_order_ui_order_delete_form_wrapper($order) {
65
  // Include the forms file from the Order module.
66
  module_load_include('inc', 'commerce_order', 'includes/commerce_order.forms');
67
  return drupal_get_form('commerce_order_ui_order_delete_form', $order);
68
}