You are here

public function BrightcoveSubscriptionController::createSubscription in Brightcove Video Connect 8

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

Create a subscription on Brightcove from an already existing entity.

Parameters

int $id: BrightcoveSubscription entity ID.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse Redirect response to redirect user after creating a Drupal only subscription.

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

File

src/Controller/BrightcoveSubscriptionController.php, line 261

Class

BrightcoveSubscriptionController
Provides controller for subscription related callbacks.

Namespace

Drupal\brightcove\Controller

Code

public function createSubscription($id) {
  try {
    $brightcove_subscription = BrightcoveSubscription::load($id);
    $brightcove_subscription
      ->saveToBrightcove();
  } catch (BrightcoveSubscriptionException $e) {
    drupal_set_message($this
      ->t('Failed to create Subscription on Brightcove: @error', [
      '@error' => $e
        ->getMessage(),
    ]), 'error');
  }
  return $this
    ->redirect('entity.brightcove_subscription.list');
}