public function ShipmentController::addShipmentPage in Commerce Shipping 8.2
Redirects to the shipment add form.
Parameters
\Drupal\commerce_order\Entity\OrderInterface $commerce_order: The commerce order to add a shipment to.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse A redirect response to the shipment add page.
File
- src/
Controller/ ShipmentController.php, line 22
Class
- ShipmentController
- Provides the add-page and title callbacks for shipments.
Namespace
Drupal\commerce_shipping\ControllerCode
public function addShipmentPage(OrderInterface $commerce_order) {
$order_type = $this->entityTypeManager
->getStorage('commerce_order_type')
->load($commerce_order
->bundle());
// Find the shipment type associated to this order type.
$shipment_type = $order_type
->getThirdPartySetting('commerce_shipping', 'shipment_type', 'default');
return $this
->redirect('entity.commerce_shipment.add_form', [
'commerce_order' => $commerce_order
->id(),
'commerce_shipment_type' => $shipment_type,
]);
}