You are here

public function ShippingMethodCondition::shippingMethodOptions in Ubercart 8.4

Shipping options callback.

Return value

array Array of all enabled shipping methods.

File

shipping/uc_quote/src/Plugin/Condition/ShippingMethodCondition.php, line 80

Class

ShippingMethodCondition
Provides an 'Order shipping method' condition.

Namespace

Drupal\uc_quote\Plugin\Condition

Code

public function shippingMethodOptions() {
  $options = [];
  $methods = $this->entityTypeManager
    ->getStorage('uc_quote_method')
    ->loadByProperties([
    'status' => TRUE,
  ]);
  uasort($methods, 'Drupal\\uc_quote\\Entity\\ShippingQuoteMethod::sort');
  foreach ($methods as $method) {
    $options[$method
      ->id()] = $method
      ->label();
  }
  return $options;
}