You are here

function theme_osmplayer_plugin_table in MediaFront 7.2

Theme the plugin table.

_state

Parameters

type $form:

1 theme call to theme_osmplayer_plugin_table()
osmplayer_player_settings_form in players/osmplayer/osmplayer.module
Implements hook_player_settings_form

File

players/osmplayer/osmplayer.module, line 812

Code

function theme_osmplayer_plugin_table($variables) {
  $info = osmplayer_get_info();
  $rows = array();
  $header = array(
    '',
    'Title',
    'Description',
    'Preview',
  );
  $element = $variables['element'];
  $js = '';
  foreach ($info['plugins'] as $name => $plugin) {
    if (!empty($plugin['preview'])) {
      $js .= 'showPlugin' . $name . ' = function() {';
      $js .= 'jQuery("body").prepend(\'<div id="dialog-modal" title="Preview"><img width="520px" height="340px" src="' . url($plugin['preview']) . '" /></div>\');';
      $js .= 'jQuery("#dialog-modal").dialog({modal: true, width: 540, height: 400, resizable: false});';
      $js .= '};';
    }
    $rows[] = array(
      drupal_render($element[$name]),
      $plugin['title'],
      $plugin['description'],
      !empty($plugin['preview']) ? '<a onclick="showPlugin' . $name . '();">Show Preview</a>' : 'None',
    );
  }
  if ($js) {

    // Add the JavaScipt to the page.
    drupal_add_js($js, 'inline');
  }

  // Return this as a table.
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
}