You are here

function opigno_install in Opigno 7

Same name and namespace in other branches
  1. 7.0 opigno.install \opigno_install()

Implements hook_install().

File

./opigno.install, line 19
Contains install instructions and logic

Code

function opigno_install() {
  db_update('system')
    ->fields(array(
    'weight' => 20,
  ))
    ->condition('name', 'opigno')
    ->execute();

  // Disable comments by default.
  if (module_exists('comment')) {
    variable_set('comment_' . OPIGNO_COURSE_BUNDLE, COMMENT_NODE_CLOSED);
  }
  $type = node_type_load(OPIGNO_COURSE_BUNDLE);
  if (empty($type)) {
    $type = node_type_set_defaults(array(
      'type' => OPIGNO_COURSE_BUNDLE,
      'name' => st('Course'),
      'base' => 'node_content',
      'description' => st("A <em>course</em> entity. This is the fundamental building bloc for Opigno. It can contain students, teachers, quizzes, files and many other ressources."),
      'custom' => 1,
      'modified' => 1,
      'locked' => 0,
      'promoted' => 0,
    ));
    node_type_save($type);
    node_add_body_field($type);
  }
  include_once drupal_get_path('module', 'og') . '/og_ui/og_ui.module';
  if (function_exists('og_ui_node_type_save')) {
    variable_set('og_group_type_' . OPIGNO_COURSE_BUNDLE, TRUE);
    og_ui_node_type_save(OPIGNO_COURSE_BUNDLE);
  }

  // Add the OG content access field.
  if (module_exists('og_access')) {
    og_create_field(OG_ACCESS_FIELD, 'node', OPIGNO_COURSE_BUNDLE);
  }
  opigno_add_image_fields();
  opigno_add_image_filters();
}