function uc_order_state_default in Ubercart 8.4
Same name and namespace in other branches
- 5 uc_order/uc_order.module \uc_order_state_default()
- 6.2 uc_order/uc_order.module \uc_order_state_default()
- 7.3 uc_order/uc_order.module \uc_order_state_default()
Returns the default order status for a particular order state.
Parameters
string $state_id: The ID of the order state whose default status you want to find.
Return value
string A string containing the default order status ID for the specified state.
8 calls to uc_order_state_default()
- CartManager::completeSale in uc_cart/
src/ CartManager.php - Completes a sale, including adjusting order status and creating an account.
- Order::preCreate in uc_order/
src/ Entity/ Order.php - Changes the values of an entity before it is created.
- OrderCommentsPane::process in uc_cart/
src/ Plugin/ Ubercart/ CheckoutPane/ OrderCommentsPane.php - Processes a checkout pane.
- OrderController::createForUser in uc_order/
src/ Controller/ OrderController.php - Creates an order for the specified user, and redirects to the edit page.
- OrderCreateForm::submitForm in uc_order/
src/ Form/ OrderCreateForm.php - Form submission handler.
File
- uc_order/
uc_order.module, line 490 - Handles all things concerning Ubercart orders.
Code
function uc_order_state_default($state_id) {
// Attempt to get the default state from the form.
$default = \Drupal::config('uc_order.settings')
->get("default_state.{$state_id}");
// If it is not found, pick the lightest status for this state.
if (!$default) {
$result = \Drupal::entityQuery('uc_order_status')
->condition('state', $state_id)
->sort('weight')
->execute();
$default = reset($result);
}
return $default;
}