You are here

function rooms_booking_edit_customer_profile in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

AJAX callback to edit the customer profile via CTools Modal.

Parameters

int $customer_id: Profile ID of the customer to edit.

1 string reference to 'rooms_booking_edit_customer_profile'
rooms_booking_menu in modules/rooms_booking/rooms_booking.module
Implements hook_menu().

File

modules/rooms_booking/rooms_booking.module, line 81
Manage Bookings - Bookings are tied to a customer profile and possible a Unit ID and Order ID.

Code

function rooms_booking_edit_customer_profile($customer_id) {
  ctools_include('modal');
  module_load_include('inc', 'commerce_customer', 'includes/commerce_customer_profile.forms');
  $form_state = array(
    'title' => t('Add customer'),
    'ajax' => TRUE,
    'build_info' => array(
      'args' => array(
        commerce_customer_profile_load($customer_id),
      ),
      'files' => array(
        'commerce_customer' => array(
          'module' => 'commerce_customer',
          'name' => 'includes/commerce_customer_profile.forms',
          'type' => 'inc',
        ),
      ),
    ),
  );

  // Wrap the form via ctools modal.
  $output = ctools_modal_form_wrapper('commerce_customer_ui_customer_profile_form', $form_state);
  if ($form_state['executed']) {
    $output = array(
      ctools_modal_command_dismiss(),
    );
  }
  print ajax_render($output);
  exit;
}