You are here

function katura_fetch_widget_html in Kaltura 7.2

Same name and namespace in other branches
  1. 6 kaltura.module \katura_fetch_widget_html()
  2. 7.3 kaltura.module \katura_fetch_widget_html()

Helper function that gets a widgetId, calls Kaltura's getWidget service and returns the embed code of the widget.

Parameters

int $widget_id:

File

./kaltura.module, line 759
Kaltura integration module - core functions.

Code

function katura_fetch_widget_html($widget_id) {
  try {
    $k_helpers = new KalturaHelpers();
    $session_user = $k_helpers
      ->getSessionUser();
    $kaltura_client = $k_helpers
      ->getKalturaClient();
    $result = $kaltura_client
      ->getWidget($session_user, $widget_id, 1);
    $embbed = $result['result']['widget']['widgetHtml'];
    return $embbed;
  } catch (Exception $e) {
    watchdog_exception('kaltura', $e);
  }
}