You are here

public function LineItemCollection::getLineItemsByType in Payment 8.2

Gets line items by plugin type.

Parameters

string $plugin_id: The line item plugin's ID.

Return value

\Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface[]

Overrides LineItemCollectionInterface::getLineItemsByType

File

src/LineItemCollection.php, line 109

Class

LineItemCollection
Provides a line item collection.

Namespace

Drupal\payment

Code

public function getLineItemsByType($plugin_id) {
  $line_items = [];
  foreach ($this
    ->getLineItems() as $name => $line_item) {
    if ($line_item
      ->getPluginId() == $plugin_id) {
      $line_items[$name] = $line_item;
    }
  }
  return $line_items;
}