You are here

function commerce_bpc_next_destination in Commerce Bulk Product Creation 7.2

Retrieves the next destination from the request parameters.

Return value

string|array A path or an array suitable to server as a value for $form_state['redirect'] or as arguments to url(). The array will

1 call to commerce_bpc_next_destination()
commerce_bpc_create_bulk_form_submit in ./commerce_bpc.forms.inc
Form submission handler for commerce_bpc_create_bulk_form().

File

./commerce_bpc.module, line 470

Code

function commerce_bpc_next_destination() {
  $destinations = !empty($_REQUEST['destinations']) ? $_REQUEST['destinations'] : array();
  if (!empty($destinations)) {
    unset($_REQUEST['destinations']);
    $destination = array_shift($destinations);
    if (!is_array($destination)) {
      $destination = array(
        $destination,
        array(),
      );
    }
    if (!empty($destinations)) {
      $destination[1]['query']['destinations'] = $destinations;
    }
    return $destination;
  }
  else {
    return 'admin/commerce/products';
  }
}