You are here

public function TaxNumberTypeManager::getPluginId in Commerce Core 8.2

Gets the plugin ID for the given country code.

If no country-specific plugin exists, the fallback plugin ID ("other") will be returned.

Parameters

string $country_code: The country code.

Return value

string The plugin ID.

Overrides TaxNumberTypeManagerInterface::getPluginId

File

modules/tax/src/TaxNumberTypeManager.php, line 60

Class

TaxNumberTypeManager
Manages tax number type plugins.

Namespace

Drupal\commerce_tax

Code

public function getPluginId($country_code) {
  $definitions = $this
    ->getDefinitions();
  foreach ($definitions as $plugin_id => $definition) {
    if (in_array($country_code, $definition['countries'])) {
      return $plugin_id;
    }
  }
  return 'other';
}