Skip to content

Commit

Permalink
Merge pull request #1206 from campusdomar/feature_22030_add_embed_vid…
Browse files Browse the repository at this point in the history
…eo_block_module

Feature 22030 add embed video block module
  • Loading branch information
Yurujai committed Jul 15, 2019
2 parents 8394965 + b65b2ee commit 69c270b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Pumukit/WebTVBundle/Controller/ModulesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,26 @@ public function byTagBlockAction($tagCod, $title)
];
}

/**
* @Template("PumukitWebTVBundle:Modules:widget_player.html.twig")
*
* @param $tagCod
*
* @throws \Exception
*
* @return array
*/
public function embedVideoBlockAction($tagCod)
{
$listService = $this->get('pumukit_web_tv.list_service');
$object = $listService->getEmbedVideoBlock($tagCod);

return [
'object' => $object,
'autostart' => false,
];
}

/**
* @throws \Exception
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% set multimediaObject = object %}
<div class="container">
{% include "PumukitWebTVBundle:MultimediaObject:template_player.html.twig" %}
</div>
26 changes: 26 additions & 0 deletions src/Pumukit/WebTVBundle/Services/ListService.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,32 @@ public function getVideosByTag($tagCod = null, $limit = 0)
], [], $limit);
}

/**
* @param null $tagCod
*
* @throws \Exception
*
* @return null|object|Tag
*/
public function getEmbedVideoBlock($tagCod = null)
{
if (!$tagCod) {
throw new \Exception('Tag code not found');
}

$tag = $this->documentManager->getRepository(Tag::class)->findOneBy([
'cod' => $tagCod,
]);

if (!$tag) {
throw new \Exception('Tag code not exist');
}

return $this->documentManager->getRepository(MultimediaObject::class)->findOneBy([
'tags.cod' => $tagCod,
]);
}

/**
* @param Builder $qb
* @param \DateTime $dateStart
Expand Down

0 comments on commit 69c270b

Please sign in to comment.