You are here

function theme_jstimer in Javascript Timer 8

Same name and namespace in other branches
  1. 6 jstimer.module \theme_jstimer()
  2. 7 jstimer.module \theme_jstimer()

File

./jstimer.module, line 46

Code

function theme_jstimer($variables) {
  $widget_name = $variables['widget_name'];
  $widget_args = $variables['widget_args'];
  $widgets = jstimer_get_widgets();
  $widget = NULL;
  foreach ($widgets as $w) {
    if ($widget_name == $w->name) {
      $widget = $w;
      break;
    }
  }
  if (!isset($widget)) {
    return "Widget {$widget_name} not found.";
  }
  if (function_exists($widget->theme_function)) {
    return call_user_func($widget->theme_function, $widget_args);
  }
  else {
    return "Widget {$widget_name} theme not found.";
  }
}