public function BrightcoveVideoController::update in Brightcove Video Connect 8
Same name and namespace in other branches
- 8.2 src/Controller/BrightcoveVideoController.php \Drupal\brightcove\Controller\BrightcoveVideoController::update()
- 3.x src/Controller/BrightcoveVideoController.php \Drupal\brightcove\Controller\BrightcoveVideoController::update()
Menu callback to update the existing Video with the latest version.
Parameters
int $entity_id: The ID of the video in Drupal.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse Redirection response.
1 string reference to 'BrightcoveVideoController::update'
File
- src/
Controller/ BrightcoveVideoController.php, line 92
Class
- BrightcoveVideoController
- Provides controller for video related callbacks.
Namespace
Drupal\brightcove\ControllerCode
public function update($entity_id) {
/** @var \Drupal\brightcove\Entity\BrightcoveVideo $video_entity */
$video_entity = BrightcoveVideo::load($entity_id);
/** @var \Brightcove\API\CMS $cms */
$cms = BrightcoveUtil::getCmsApi($video_entity
->getApiClient());
// Update video.
$video = $cms
->getVideo($video_entity
->getVideoId());
$this->videoQueue
->createItem([
'api_client_id' => $video_entity
->getApiClient(),
'video' => $video,
]);
// Run batch.
batch_set([
'operations' => [
[
[
BrightcoveUtil::class,
'runQueue',
],
[
'brightcove_video_queue_worker',
],
],
[
[
BrightcoveUtil::class,
'runQueue',
],
[
'brightcove_text_track_queue_worker',
],
],
[
[
BrightcoveUtil::class,
'runQueue',
],
[
'brightcove_text_track_delete_queue_worker',
],
],
],
]);
// Run batch and redirect back to the video edit form.
return batch_process(Url::fromRoute('entity.brightcove_video.edit_form', [
'brightcove_video' => $entity_id,
]));
}