aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--start.php28
-rw-r--r--views/default/object/videolist_item.php7
2 files changed, 32 insertions, 3 deletions
diff --git a/start.php b/start.php
index 2791b1185..77bf0a7bc 100644
--- a/start.php
+++ b/start.php
@@ -289,6 +289,34 @@ function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
}
/**
+ * @param ElggObject $videolist_item
+ * @return array
+ */
+function videolist_get_video_dimensions(ElggObject $videolist_item) {
+ $dimensions = array(
+ 'width' => 600,
+ 'height' => 400,
+ );
+ $params['entity'] = $videolist_item;
+ $params['videotype'] = $videolist_item->videotype;
+ $dimensions = elgg_trigger_plugin_hook(
+ 'videolist:setdimensions',
+ $params['videotype'],
+ $params,
+ $dimensions);
+ if (! is_array($dimensions)) {
+ $dimensions = array();
+ }
+ if (empty($dimensions['width']) || ! is_numeric($dimensions['width'])) {
+ $dimensions['width'] = 600;
+ }
+ if (empty($dimensions['height']) || ! is_numeric($dimensions['height'])) {
+ $dimensions['height'] = 400;
+ }
+ return $dimensions;
+}
+
+/**
* Prepend HTTP scheme if missing
* @param string $hook
* @param string $type
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index e30d9d95b..5e0db00ce 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -60,11 +60,12 @@ if (elgg_in_context('widgets')) {
}
if ($full && !elgg_in_context('gallery')) {
-
+
+ $dimensions = videolist_get_video_dimensions($entity);
$content = elgg_view("videolist/watch/{$entity->videotype}", array(
'entity' => $entity,
- 'width' => 600,
- 'height' => 400,
+ 'width' => $dimensions['width'],
+ 'height' => $dimensions['height'],
));
$content = "<div class=\"videolist-watch\">$content</div>";