function opigno_group_manager_install in Opigno group manager 3.x
Same name and namespace in other branches
- 8 opigno_group_manager.install \opigno_group_manager_install()
Implements hook_install().
File
- ./opigno_group_manager.install, line 13 
- Opigno group manager install/update functionality.
Code
function opigno_group_manager_install() {
  \Drupal::service('module_installer')
    ->install([
    'serialization',
  ]);
  try {
    $definition = \Drupal::entityTypeManager()
      ->getDefinition('opigno_group_link');
  } catch (PluginNotFoundException $e) {
    watchdog_exception('opigno_group_manager_exception', $e);
    return;
  }
  // Make field "required_activities" value to be null.
  // @todo: add this settings to BaseFieldDefinition::create() for this field.
  $schema = \Drupal::database()
    ->schema();
  if ($schema
    ->fieldExists($definition
    ->getBaseTable(), 'required_activities')) {
    $schema
      ->changeField($definition
      ->getBaseTable(), 'required_activities', 'required_activities', [
      'type' => 'varchar',
      'length' => 8191,
      'not null' => FALSE,
    ]);
  }
}