You are here

function name_install_default_formats in Name Field 7

Same name and namespace in other branches
  1. 6 name.install \name_install_default_formats()

Inserts some common formats.

2 calls to name_install_default_formats()
name_install in ./name.install
Implements hook_install().
name_update_6000 in ./name.install
This adds the formats that would otherwise be inserted during installation.

File

./name.install, line 230
Standard installation functions for name.

Code

function name_install_default_formats() {
  $t = get_t();
  $formats = array(
    array(
      'format' => '((((t+ig)+im)+if)+is)+jc',
      'name' => $t('Full'),
      'machine_name' => 'full',
    ),
    array(
      'format' => 'g',
      'name' => $t('Given'),
      'machine_name' => 'given',
    ),
    array(
      'format' => 'f',
      'name' => $t('Family'),
      'machine_name' => 'family',
    ),
    array(
      'format' => 't+if',
      'name' => $t('Title Family'),
      'machine_name' => 'formal',
    ),
    array(
      'format' => 'g+if',
      'name' => $t('Given Family'),
      'machine_name' => 'short_full',
    ),
  );
  foreach ($formats as $format) {
    db_insert('name_custom_format')
      ->fields(array(
      'name' => $format['name'],
      'machine_name' => $format['machine_name'],
      'format' => $format['format'],
    ))
      ->execute();
  }
}