You are here

function opigno_forum_install in Opigno forum 8

Same name and namespace in other branches
  1. 3.x opigno_forum.install \opigno_forum_install()

Creates field for a forum reference in a training groups.

File

./opigno_forum.install, line 18
Install, update and uninstall functions for the Opigno Forum module.

Code

function opigno_forum_install($is_syncing) {
  if (!$is_syncing) {
    $config_path = drupal_get_path('module', 'opigno_forum') . '/config/install';
    $storage = new FileStorage($config_path);
    $data = $storage
      ->read('field.storage.group.field_learning_path_forum');
    if (!FieldStorageConfig::loadByName($data['entity_type'], $data['field_name'])) {
      FieldStorageConfig::create($data)
        ->save();
    }
    $data = $storage
      ->read('field.field.group.learning_path.field_learning_path_forum');
    if (!FieldConfig::loadByName($data['entity_type'], $data['bundle'], $data['field_name'])) {
      FieldConfig::create($data)
        ->save();
    }
  }
}