You are here

public static function Shipment::getWorkflowId in Commerce Shipping 8.2

Gets the workflow ID for the state field.

Parameters

\Drupal\commerce_shipping\Entity\ShipmentInterface $shipment: The shipment.

Return value

string The workflow ID.

File

src/Entity/Shipment.php, line 730

Class

Shipment
Defines the shipment entity class.

Namespace

Drupal\commerce_shipping\Entity

Code

public static function getWorkflowId(ShipmentInterface $shipment) {
  if (!empty($shipping_method = $shipment
    ->get('shipping_method')->entity)) {
    if (!empty($plugin = $shipping_method
      ->getPlugin())) {
      return $plugin
        ->getWorkflowId();
    }
  }
  return 'shipment_default';
}