class ShipmentController in Commerce Shipping 8.2
Provides the add-page and title callbacks for shipments.
Hierarchy
- class \Drupal\Core\Entity\Controller\EntityController implements ContainerInjectionInterface uses UrlGeneratorTrait, StringTranslationTrait- class \Drupal\commerce_shipping\Controller\ShipmentController
 
Expanded class hierarchy of ShipmentController
1 file declares its use of ShipmentController
File
- src/Controller/ ShipmentController.php, line 11 
Namespace
Drupal\commerce_shipping\ControllerView source
class ShipmentController extends EntityController {
  /**
   * Redirects to the shipment add form.
   *
   * @param \Drupal\commerce_order\Entity\OrderInterface $commerce_order
   *   The commerce order to add a shipment to.
   *
   * @return \Symfony\Component\HttpFoundation\RedirectResponse
   *   A redirect response to the shipment add page.
   */
  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,
    ]);
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| EntityController:: | protected | property | The entity repository. | |
| EntityController:: | protected | property | The entity type bundle info. | |
| EntityController:: | protected | property | The entity manager. | |
| EntityController:: | protected | property | The renderer. | |
| EntityController:: | public | function | Provides a generic add title callback for entities with bundles. | |
| EntityController:: | public | function | Displays add links for the available bundles. | |
| EntityController:: | public | function | Provides a generic add title callback for an entity type. | |
| EntityController:: | public static | function | Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: | |
| EntityController:: | public | function | Provides a generic delete title callback. | |
| EntityController:: | protected | function | Determines the entity. | |
| EntityController:: | public | function | Provides a generic edit title callback. | |
| EntityController:: | protected | function | Expands the bundle information with descriptions, if known. | |
| EntityController:: | protected | function | Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait:: | |
| EntityController:: | public | function | Provides a generic title callback for a single entity. | |
| EntityController:: | public | function | Constructs a new EntityController. | |
| ShipmentController:: | public | function | Redirects to the shipment add form. | |
| StringTranslationTrait:: | protected | property | The string translation service. | 1 | 
| StringTranslationTrait:: | protected | function | Formats a string containing a count of items. | |
| StringTranslationTrait:: | protected | function | Returns the number of plurals supported by a given language. | |
| StringTranslationTrait:: | protected | function | Gets the string translation service. | |
| StringTranslationTrait:: | public | function | Sets the string translation service to use. | 2 | 
| StringTranslationTrait:: | protected | function | Translates a string to the current language or to a given language. | |
| UrlGeneratorTrait:: | protected | property | The url generator. | |
| UrlGeneratorTrait:: | protected | function | Returns the URL generator service. | |
| UrlGeneratorTrait:: | public | function | Sets the URL generator service. | |
| UrlGeneratorTrait:: | protected | function | Generates a URL or path for a specific route based on the given parameters. | 
