You are here

public function CountryController::disableConfig in Ubercart 8.4

Disables a country.

Parameters

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

Return value

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

1 string reference to 'CountryController::disableConfig'
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 39

Class

CountryController
Utility functions to enable and disable country configuration entities.

Namespace

Drupal\uc_country\Controller

Code

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