You are here

protected function field_timer_county_date_field_base::generateJSSettings in Field Timer 7.2

@inheritdoc

Overrides field_timer_county_base::generateJSSettings

File

includes/field_timer_county.inc, line 441
Help file. Contains help classes to perform field_timer_county formatter related actions.

Class

field_timer_county_date_field_base
Base class for field_timer_text formatter and date field types.

Code

protected function generateJSSettings($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $js_settings = parent::generateJSSettings($entity_type, $entity, $field, $instance, $langcode, $items, $display);
  if (!empty($field['settings']['todate'])) {
    $info = entity_get_info($entity_type);
    $id_key = $info['entity keys']['id'];
    $settings = $display['settings'];
    $settings2 = array();
    foreach ($settings as $name => $value) {
      if (substr($name, strlen($name) - 1) == '2') {
        $settings2[substr($name, 0, strlen($name) - 1)] = $value;
      }
    }
    foreach ($items as $delta => $item) {
      $key = $entity_type . '_' . $entity->{$id_key} . '_' . $field['field_name'] . '_' . $delta . '_2';
      $js_settings[$key]['timestamp'] = $this
        ->getTimestamp($item, $field, 'value2');
      $js_settings[$key]['options'] = $settings2;
      $js_settings[$key]['plugin'] = $this
        ->getPluginName();
    }
  }
  return $js_settings;
}