-
Notifications
You must be signed in to change notification settings - Fork 11
/
townsquare.install
75 lines (71 loc) · 1.78 KB
/
townsquare.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* @file townsquare.install
*/
/**
* Implements hook_install_tasks().
*/
function townsquare_install_tasks() {
$tasks = array();
$tasks['townsquare_load_content'] = array(
'display_name' => st('Townsquare load content'),
'display' => FALSE,
'type' => 'batch',
);
return $tasks;
}
function townsquare_load_content() {
$path = drupal_get_path('profile', 'townsquare') .'/docs/';
$files = array(
'home' => array(
'title' => t('Home'),
'type' => 'wiki',
'path' => $path .'home.md',
'format' => 'markdown_advanced',
),
'project' => array(
'title' => t('About Townsquare'),
'type' => 'wiki',
'path' => $path .'project.md',
'format' => 'markdown_advanced',
),
'test_markdown_restricted' => array(
'title' => t('Test Markdown Restricted input format'),
'type' => 'wiki',
'path' => $path .'test_markdown_restricted.md',
'format' => 'markdown',
),
'install' => array(
'title' => t('Install Townsquare'),
'type' => 'wiki',
'path' => $path .'install.md',
'format' => 'markdown_advanced',
),
'tutorial' => array(
'title' => t('Townsquare tutorial'),
'type' => 'wiki',
'path' => $path .'tutorial.md',
'format' => 'markdown_advanced',
),
);
foreach ($files as $file) {
$node = new stdClass();
$node->type = $file['type'];
$node->title = $file['title'];
$node->uid = 1;
$node->status = 1;
$node->promote = 0;
$node->sticky = 0;
$node->language = LANGUAGE_NONE;
$node->body = array(
'und' => array(
array(
'value' => file_get_contents($file['path']),
'summary' => '',
'format' => $file['format'],
),
)
);
node_save($node);
}
}