Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

feat(player): make players responsive

Embedded videos and rich players are now responsive by default.

Fixes hypeJunction/hypeEmbed#5
  • Loading branch information...
hypeJunction committed Jun 26, 2017
1 parent 24bd9f4 commit 88fad4d9650564de646495d8af5f00f490055623
Showing with 20 additions and 1 deletion.
  1. +20 −1 views/default/output/player.php
@@ -1,5 +1,10 @@
<?php
/**
* @uses $vars['href'] URL to be previewed
* @uses $vars['fallback'] Fallback to card view if no HTML content is associated with the URL
* @uses $vars['responsive'] Make the player responsive
*/
$href = elgg_extract('href', $vars);
$data = hypeapps_scrape($href);
@@ -8,7 +13,21 @@
}
if ($data['html']) {
echo $data['html'];
$preview = $data['html'];
if (elgg_extract('responsive', $vars, true)) {
$classes = ['scraper-card-flex', 'clearfix'];
if ($data['provider_name']) {
$classes[] = "scraper-card-{$data['provider_name']}";
}
$player = elgg_format_element('div', [
'class' => $classes,
], $preview);
echo elgg_format_element('div', [
'class' => "scraper-card-{$data['type']}",
], $player);
} else {
echo $preview;
}
} else if (elgg_extract('fallback', $vars, true)) {
echo elgg_view('output/card', [
'href' => $href,

0 comments on commit 88fad4d

Please sign in to comment.
You can’t perform that action at this time.