function date_default_value

cis7 date_elements.inc date_default_value($field, $instance, $langcode)
cle7 date_elements.inc date_default_value($field, $instance, $langcode)
elmsmedia7 date_elements.inc date_default_value($field, $instance, $langcode)
icor7 date_elements.inc date_default_value($field, $instance, $langcode)
meedjum_blog7 date_elements.inc date_default_value($field, $instance, $langcode)
mooc7 date_elements.inc date_default_value($field, $instance, $langcode)

The callback for setting a default value for an empty date field.

1 call to date_default_value()
date_field_widget_form in sites/all/modules/ulmus/date/date_elements.inc
Private implementation of hook_widget().

File

sites/all/modules/ulmus/date/date_elements.inc, line 174
Date forms and form themes and validation.

Code

function date_default_value($field, $instance, $langcode) {
  $item = array();
  $db_format = date_type_format($field['type']);
  $date = date_default_value_part($item, $field, $instance, $langcode, 'value');
  $item[0]['value'] = is_object($date) ? date_format($date, $db_format) : '';
  if (!empty($field['settings']['todate'])) {
    $date = date_default_value_part($item, $field, $instance, $langcode, 'value2');
    $item[0]['value2'] = is_object($date) ? date_format($date, $db_format) : '';
  }

  // Make sure the default value has the same construct as a loaded field value
  // to avoid errors if the default value is used on a hidden element.
  $item[0]['timezone'] = date_get_timezone($field['settings']['tz_handling']);
  $item[0]['timezone_db'] = date_get_timezone_db($field['settings']['tz_handling']);
  $item[0]['date_type'] = $field['type'];
  if (!isset($item[0]['value2'])) {
    $item[0]['value2'] = $item[0]['value'];
  }
  return $item;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.