You are here

function jst_timer_show in Javascript Timer 8

Same name and namespace in other branches
  1. 6 widgets/jst_timer.module \jst_timer_show()
  2. 7 widgets/jst_timer.module \jst_timer_show()
1 call to jst_timer_show()
JsTimerDefaultFormatter::viewElements in src/Plugin/Field/FieldFormatter/JsTimerDefaultFormatter.php
Builds a renderable array for a field value.
1 string reference to 'jst_timer_show'
jst_timer_jstwidget in widgets/jst_timer.module
Implementation of hook_jstwidget().

File

widgets/jst_timer.module, line 505
Default widget implementation for an up and down timer. This widget does not use hook_ctwidget as it is always included.

Code

function jst_timer_show($widget_args) {
  $output = '<span class="jst_timer">';
  if (isset($widget_args['no_js_txt'])) {
    $output .= $widget_args['no_js_txt'];
  }
  $valid_atts = array(
    'datetime',
    'dir',
    'format_txt',
    'format_num',
    'threshold',
    'complete',
    'tc_redir',
    'tc_redir_delay',
    'tc_msg',
    'interval',
    'current_server_time',
  );
  foreach ($valid_atts as $att) {
    if (isset($widget_args[$att])) {
      $output .= '<span style="display:none" class="' . $att . '">' . $widget_args[$att] . '</span>';
    }
  }
  $output .= '</span>';
  return $output;
}