You are here

opigno_group_manager.install in Opigno group manager 3.x

Same filename and directory in other branches
  1. 8 opigno_group_manager.install

Opigno group manager install/update functionality.

File

opigno_group_manager.install
View source
<?php

/**
 * @file
 * Opigno group manager install/update functionality.
 */
use Drupal\Component\Plugin\Exception\PluginNotFoundException;

/**
 * Implements hook_install().
 */
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,
    ]);
  }
}

Functions

Namesort descending Description
opigno_group_manager_install Implements hook_install().