You are here

public function BrightcovePlaylistController::update in Brightcove Video Connect 8

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

Menu callback to update the existing Playlist with the latest version.

Parameters

int $entity_id: The ID of the playlist in Drupal.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse Redirection response.

1 string reference to 'BrightcovePlaylistController::update'
brightcove.routing.yml in ./brightcove.routing.yml
brightcove.routing.yml

File

src/Controller/BrightcovePlaylistController.php, line 62

Class

BrightcovePlaylistController
Provides controller for playlist related callbacks.

Namespace

Drupal\brightcove\Controller

Code

public function update($entity_id) {

  /** @var \Drupal\brightcove\Entity\BrightcovePlaylist $playlist */
  $playlist = BrightcovePlaylist::load($entity_id);

  /** @var \Brightcove\API\CMS $cms */
  $cms = BrightcoveUtil::getCmsApi($playlist
    ->getApiClient());

  // Update playlist.
  BrightcovePlaylist::createOrUpdate($cms
    ->getPlaylist($playlist
    ->getPlaylistId()), $this->playlistStorage, $this->videoStorage);

  // Redirect back to the playlist edit form.
  return $this
    ->redirect('entity.brightcove_playlist.edit_form', [
    'brightcove_playlist' => $entity_id,
  ]);
}