You are here

public function Manual::fulfillOrder in Ubercart 8.4

Fulfills the order using this method.

Parameters

\Drupal\uc_order\OrderInterface $order: The order to fulfill.

array $package_ids: An array of package ids to shipped.

Return value

\Drupal\Core\Form\FormInterface A form to process the order fulfillment.

Overrides FulfillmentMethodPluginInterface::fulfillOrder

File

shipping/uc_fulfillment/src/Plugin/Ubercart/FulfillmentMethod/Manual.php, line 89

Class

Manual
Provides a manual fulfillment plugin.

Namespace

Drupal\uc_fulfillment\Plugin\Ubercart\FulfillmentMethod

Code

public function fulfillOrder(OrderInterface $order, array $package_ids) {
  $shipment = Shipment::create();
  $shipment
    ->setOrderId($order
    ->id());
  $packages = [];
  foreach ($package_ids as $id) {
    $package = Package::load($id);
    $packages[$id] = $package;
  }
  $shipment
    ->setPackages($packages);
  return \Drupal::formBuilder()
    ->getForm('\\Drupal\\uc_fulfillment\\Form\\ShipmentEditForm', $order, $shipment);
}