You are here

public function LocalStockChecker::getLocationList in Commerce Stock 8

Gets the locations. This is an old implementation of the now changed interface.

Deprecated

in commerce_stock:8.x-1.0 and is removed from commerce_stock:8.x-2.0. Use the StockLocationStorage service instead.

File

modules/local_storage/src/LocalStockChecker.php, line 209

Class

LocalStockChecker
The stock checker implementation for the local stock module.

Namespace

Drupal\commerce_stock_local

Code

public function getLocationList($return_active_only = TRUE) {
  $locations = $this->locationStorage
    ->loadMultiple();
  if ($return_active_only) {
    $active = [];

    /** @var StockLocationInterface $location */
    foreach ($locations as $location) {
      if ($location
        ->isActive()) {
        $active[] = $location;
      }
    }
    return $active;
  }
  return $locations;
}