You are here

public function CountryController::enableConfig in Ubercart 8.4

Enables a country.

Parameters

\Drupal\uc_country\Entity\Country $uc_country: The country object to enable.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A redirect response to the country listing page.

1 string reference to 'CountryController::enableConfig'
uc_country.routing.yml in uc_country/uc_country.routing.yml
uc_country/uc_country.routing.yml

File

uc_country/src/Controller/CountryController.php, line 22

Class

CountryController
Utility functions to enable and disable country configuration entities.

Namespace

Drupal\uc_country\Controller

Code

public function enableConfig(Country $uc_country) {
  $uc_country
    ->enable()
    ->save();
  $this
    ->messenger()
    ->addMessage($this
    ->t('The country %label has been enabled.', [
    '%label' => $uc_country
      ->label(),
  ]));
  return $this
    ->redirect('entity.uc_country.collection');
}