You are here

public function Country::__construct in Address 8

Same name in this branch
  1. 8 src/Plugin/views/sort/Country.php \Drupal\address\Plugin\views\sort\Country::__construct()
  2. 8 src/Plugin/views/field/Country.php \Drupal\address\Plugin\views\field\Country::__construct()

Constructs a new Country object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The id of the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

\CommerceGuys\Addressing\Country\CountryRepositoryInterface $country_repository: The country repository.

\Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager.

Overrides HandlerBase::__construct

File

src/Plugin/views/sort/Country.php, line 61

Class

Country
Sort handler for sorting by either country code or name.

Namespace

Drupal\address\Plugin\views\sort

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, CountryRepositoryInterface $country_repository, LanguageManagerInterface $language_manager) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->countryRepository = $country_repository;
  $this->langcode = $language_manager
    ->getCurrentLanguage()
    ->getId();
}