summaryrefslogtreecommitdiffstats
path: root/dkan.install
blob: 4174364e24bf91e5850aa87f5b6d66f5d0f5f8bf (plain)
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
<?php

/**
 * Implements hook_install().
 */
function dkan_install() {
  theme_enable(array('dkan'));
  theme_enable(array('seven'));
  variable_set('theme_default', 'dkan');
  variable_set('admin_theme', 'seven');
  variable_set('jquery_update_jquery_version', '1.7');

  // Change block titles for selected blocks.
  db_query("UPDATE {block} SET title ='<none>' WHERE delta = 'main-menu' OR delta = 'login'");
}

/**
 * Implements hook_install_tasks()
 */
function dkan_install_tasks() {
  // Kick off the tasks.
  $tasks = array();
  $tasks['dkan_additional_setup'] = array(
    'display_name' => 'Cleanup',
  );
  $tasks['dkan_additional_terms'] = array(
    'display_name' => 'Taxonomy Terms',
  );
  return $tasks;
}

/**
 * Implements hook_install_tasks()
 */
function dkan_additional_setup() {
  // Change block titles for selected blocks.
  db_query("UPDATE {block} SET title ='<none>' WHERE delta = 'main-menu' OR delta = 'login'");
}

/**
 * Adds default taxonomy terms.
 */
function dkan_additional_terms() {
  $tags = array(
    'country-afghanistan',
    'election',
    'politics',
    'transparency',
  );
  foreach ($tags as $tag) {
    $term = new stdClass();
    // 'Tags' vid.
    $term->vid = 2;
    $term->name = $tag;
    taxonomy_term_save($term);
  }
  $formats = array(
    'csv',
    'html',
  );
  foreach ($formats as $format) {
    $term = new stdClass();
    // 'Formats' vid.
    $term->vid = 1;
    $term->name = $tag;
    taxonomy_term_save($term);
  }
}