You are here

function date_install_create_format in Date 6.2

1 call to date_install_create_format()
date_update_6005 in date/date.install

File

date/date.install, line 369

Code

function date_install_create_format($field, $title, $name, $format) {
  if (empty($name) || empty($format)) {
    return;
  }
  $fields = content_fields();
  if (empty($title)) {
    $type = str_replace($field['field_name'] . '_', '', $name);
    $field = $fields[$field['field_name']];
    $title = $field['widget']['label'];
  }
  variable_set('date_format_' . $name, $format);
  db_query("INSERT INTO {date_format_types} (type, title, locked) VALUES('%s', '%s', 0)", $name, $title);
  if (!db_result(db_query("SELECT dfid FROM {date_formats} WHERE format='%s' AND type='%s'", $format, $type))) {
    db_query("INSERT INTO {date_formats} (format, type, locked) VALUES('%s', '%s', 0)", $format, 'custom');
  }
}