You are here

protected function JsTimerDefaultFormatter::dateToWidget in Javascript Timer 8

1 call to JsTimerDefaultFormatter::dateToWidget()
JsTimerDefaultFormatter::viewElements in src/Plugin/Field/FieldFormatter/JsTimerDefaultFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/JsTimerDefaultFormatter.php, line 97

Class

JsTimerDefaultFormatter
Plugin implementation of the 'JsTimer' formatter for 'datetime' fields.

Namespace

Drupal\jstimer\Plugin\Field\FieldFormatter

Code

protected function dateToWidget($unix_timestamp, $widget_name, $settings = array()) {
  $datetime = date_iso8601($unix_timestamp);
  $widget_args = array(
    'widget_name' => $widget_name,
    'widget_args' => array(
      'datetime' => $datetime,
    ),
  );
  foreach ($settings as $key => $val) {
    if ($val != '') {
      $widget_args['widget_args'][$key] = $val;
    }
  }
  return $widget_args;
}