function system_date_format_type_save

7.x system.module system_date_format_type_save($type)

Saves a date type to the database.

Parameters

$type: A date type array containing the following keys:

  • type: The machine-readable name of the date type.
  • title: The human-readable name of the date type.
  • locked: A boolean indicating whether or not this date type should be configurable from the user interface.
  • is_new: A boolean indicating whether or not this date type is as of yet unsaved in the database.
2 calls to system_date_format_type_save()
system_add_date_format_type_form_submit in drupal-7.x/modules/system/system.admin.inc
Process system_add_date_format_type form submissions.
_system_date_formats_build in drupal-7.x/modules/system/system.module
Builds and returns information about available date formats.

File

drupal-7.x/modules/system/system.module, line 3830
Configuration system that lets administrators modify the workings of the site.

Code

function system_date_format_type_save($type) {
  $info = array();
  $info['type'] = $type['type'];
  $info['title'] = $type['title'];
  $info['locked'] = $type['locked'];

  // Update date_format table.
  if (!empty($type['is_new'])) {
    drupal_write_record('date_format_type', $info);
  }
  else {
    drupal_write_record('date_format_type', $info, 'type');
  }
}