public function BrightcoveSubscriptionController::enable in Brightcove Video Connect 8
Same name and namespace in other branches
- 8.2 src/Controller/BrightcoveSubscriptionController.php \Drupal\brightcove\Controller\BrightcoveSubscriptionController::enable()
- 3.x src/Controller/BrightcoveSubscriptionController.php \Drupal\brightcove\Controller\BrightcoveSubscriptionController::enable()
Enables and creates 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::enable'
File
- src/Controller/ BrightcoveSubscriptionController.php, line 283 
Class
- BrightcoveSubscriptionController
- Provides controller for subscription related callbacks.
Namespace
Drupal\brightcove\ControllerCode
public function enable($id) {
  try {
    $subscription = BrightcoveSubscription::load($id);
    $subscription
      ->saveToBrightcove();
    drupal_set_message($this
      ->t('Default subscription for the "@api_client" API client has been successfully enabled.', [
      '@api_client' => $subscription
        ->getApiClient()
        ->label(),
    ]));
  } catch (\Exception $e) {
    drupal_set_message($this
      ->t('Failed to enable the default subscription: @error', [
      '@error' => $e
        ->getMessage(),
    ]), 'error');
  }
  return $this
    ->redirect('entity.brightcove_subscription.list');
}