function forward_install in Forward 7.3
Same name and namespace in other branches
- 8.3 forward.install \forward_install()
- 8 forward.install \forward_install()
- 8.2 forward.install \forward_install()
- 5 forward.install \forward_install()
- 6 forward.install \forward_install()
- 7 forward.install \forward_install()
- 7.2 forward.install \forward_install()
- 4.x forward.install \forward_install()
- 4.0.x forward.install \forward_install()
Implements hook_install().
File
- ./
forward.install, line 12 - Install, update and uninstall functions for the forward module.
Code
function forward_install() {
// Default to show Forward on full entity view mode
variable_set('forward_view_full', TRUE);
// Setup mail system for HTML emails
$mail_systems = variable_get('mail_system', array(
'default-system' => 'DefaultMailSystem',
));
$mail_systems['forward'] = 'ForwardMailSystem';
variable_set('mail_system', $mail_systems);
// Warn administrator
if (module_exists('mailsystem')) {
$link = l(t('Review or change your mail setup.'), 'admin/config/system/mailsystem', array());
drupal_set_message(t('The mail system for Forward has been set to enable HTML emails. ') . $link, 'warning');
}
// Initialize statistics table:
// Nodes
$query = db_select('node', 'n');
$query
->addExpression("'node'", 'type');
$query
->addField('n', 'type', 'bundle');
$query
->addField('n', 'nid', 'id');
db_insert('forward_statistics')
->from($query)
->execute();
// Taxonomy terms
if (module_exists('taxonomy')) {
$query = db_select('taxonomy_term_data', 't');
$query
->join('taxonomy_vocabulary', 'v', 't.vid = v.vid');
$query
->addExpression("'taxonomy_term'", 'type');
$query
->addField('v', 'machine_name', 'bundle');
$query
->addField('t', 'tid', 'id');
db_insert('forward_statistics')
->from($query)
->execute();
}
// Users
$query = db_select('users', 'u');
$query
->addExpression("'user'", 'type');
$query
->addExpression("'user'", 'bundle');
$query
->addField('u', 'uid', 'id');
db_insert('forward_statistics')
->from($query)
->execute();
// Other entity types with view modes
$entity_types = entity_get_info();
foreach ($entity_types as $type => $info) {
if ($type != 'node' && $type != 'taxonomy_term' && $type != 'user') {
if (!empty($info['view modes'])) {
$entity_list = entity_load($type);
foreach ($entity_list as $entity) {
forward_entity_insert($entity, $type);
}
}
}
}
}