function name_update_6000 in Name Field 6
Same name and namespace in other branches
- 7 name.install \name_update_6000()
This adds the formats that would otherwise be inserted during installation.
File
- ./
name.install, line 84 - Standard installation functions for name.
Code
function name_update_6000() {
$ret = array();
// Create the table.
$schema = array(
'fields' => array(
'ncfid' => array(
'description' => t('The primary identifier for a custom format.'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => t('The name to identify the custom format to a user.'),
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'machine_name' => array(
'description' => t('The machine name to identify the custom format to the system.'),
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'format' => array(
'description' => t('The format string to apply to names.'),
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
),
'primary key' => array(
'ncfid',
),
);
db_create_table($ret, 'name_custom_format', $schema);
// Install some default values.
$t = get_t();
name_install_default_formats();
$ret[] = array(
'success' => TRUE,
'query' => $t('Created some custom name format strings. These are listed !here.', array(
'!here' => l($t('here', 'admin/settings/name')),
)),
);
// Clear the caches.
cache_clear_all('*', 'cache', TRUE);
cache_clear_all('*', 'cache_content', TRUE);
if (module_exists('views')) {
// Needed because this can be called from .install files
module_load_include('module', 'views');
views_invalidate_cache();
}
return $ret;
}