function uc_order_state_options_list in Ubercart 8.4
Returns an option list of order states.
5 calls to uc_order_state_options_list()
- OrderStateCondition::orderStateOptions in uc_order/
src/ Plugin/ Condition/ OrderStateCondition.php - Options callback.
- OrderStatusAddForm::buildForm in uc_order/
src/ Form/ OrderStatusAddForm.php - Form constructor.
- OrderTest::testCustomOrderStatus in uc_order/
tests/ src/ Functional/ OrderTest.php - Tests using custom order statuses.
- OrderWorkflowForm::buildForm in uc_order/
src/ Form/ OrderWorkflowForm.php - Form constructor.
- uc_order_condition_order_state_options in uc_order/
uc_order.rules.inc - Options callback.
File
- uc_order/
uc_order.module, line 466 - Handles all things concerning Ubercart orders.
Code
function uc_order_state_options_list() {
$discovery = new YamlDiscovery('uc_order_state', \Drupal::moduleHandler()
->getModuleDirectories());
$states = [];
foreach ($discovery
->findAll() as $file) {
$states = array_merge($states, $file);
}
uasort($states, 'Drupal\\Component\\Utility\\SortArray::sortByWeightElement');
$options = [];
foreach ($states as $id => $state) {
$options[$id] = $state['label'];
}
return $options;
}