You are here

function opigno_moxtra_user_insert in Opigno Moxtra 8

Same name and namespace in other branches
  1. 3.x opigno_moxtra.module \opigno_moxtra_user_insert()

Implements hook_ENTITY_TYPE_insert().

Creates user in the Moxtra.

File

./opigno_moxtra.module, line 547
Contains opigno_moxtra.module.

Code

function opigno_moxtra_user_insert(EntityInterface $entity) {

  /** @var \Drupal\user\Entity\User $entity */
  $user_active = $entity
    ->isActive();
  $connector = \Drupal::service('opigno_moxtra.connector');
  if ($user_active && $connector
    ->checkSettings()) {
    $moxtra = \Drupal::service('opigno_moxtra.moxtra_api');
    $moxtra
      ->setUser($entity);
  }
}