You are here

protected function TaxRateResolver::getTaxFieldNames in Commerce Product Tax 8

Gets the tax field names attached to the purchasable entity.

Parameters

\Drupal\commerce\PurchasableEntityInterface $entity: The purchasable entity.

Return value

array An array of tax field names.

1 call to TaxRateResolver::getTaxFieldNames()
TaxRateResolver::resolve in src/Resolver/TaxRateResolver.php
Resolves the tax rate for the given tax zone.

File

src/Resolver/TaxRateResolver.php, line 68

Class

TaxRateResolver
Returns the tax rate configured on the product variation.

Namespace

Drupal\commerce_product_tax\Resolver

Code

protected function getTaxFieldNames(PurchasableEntityInterface $entity) {
  $field_names = [];
  foreach ($entity
    ->getFieldDefinitions() as $field) {
    if ($field
      ->getType() == 'commerce_tax_rate') {
      $field_names[] = $field
        ->getName();
    }
  }
  return $field_names;
}