You are here

public function BrightcoveSubscriptionController::disable in Brightcove Video Connect 8.2

Same name and namespace in other branches
  1. 8 src/Controller/BrightcoveSubscriptionController.php \Drupal\brightcove\Controller\BrightcoveSubscriptionController::disable()
  2. 3.x src/Controller/BrightcoveSubscriptionController.php \Drupal\brightcove\Controller\BrightcoveSubscriptionController::disable()

Disabled and removed the default Subscription from Brightcove.

Parameters

string $id: The ID of the Brightcove Subscription.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse Redirect response to redirect user after enabling the default subscription.

1 string reference to 'BrightcoveSubscriptionController::disable'
brightcove.routing.yml in ./brightcove.routing.yml
brightcove.routing.yml

File

src/Controller/BrightcoveSubscriptionController.php, line 321

Class

BrightcoveSubscriptionController
Provides controller for subscription related callbacks.

Namespace

Drupal\brightcove\Controller

Code

public function disable($id) {
  try {
    $subscription = BrightcoveSubscription::load($id);
    $subscription
      ->deleteFromBrightcove();
    drupal_set_message($this
      ->t('Default subscription for the "@api_client" API client has been successfully disabled.', [
      '@api_client' => $subscription
        ->getApiClient()
        ->label(),
    ]));
  } catch (\Exception $e) {
    drupal_set_message($this
      ->t('Failed to disable the default subscription: @error', [
      '@error' => $e
        ->getMessage(),
    ]), 'error');
  }
  return $this
    ->redirect('entity.brightcove_subscription.list');
}