function sendinblue_user_insert in SendinBlue 8.2
Same name and namespace in other branches
- 8 sendinblue.module \sendinblue_user_insert()
Implements hook_ENTITY_TYPE_insert() for node entities.
This tests saving a node on node insert.
See also
\Drupal\node\Tests\NodeSaveTest::testNodeSaveOnInsert()
File
- ./
sendinblue.module, line 73 - The entry point of Sendinblue module.
Code
function sendinblue_user_insert(UserInterface $user) {
/** @var \Drupal\sendinblue\SendinblueManager $sendInBlueManager */
$sendInBlueManager = \Drupal::service('sendinblue.manager');
/** @var \Drupal\Core\Config\ConfigFactoryInterface $configFactory */
$configFactory = \Drupal::service('config.factory');
$sendinblue_registered_active = $configFactory
->get(SendinblueManager::CONFIG_SETTINGS_REGISTERING_USER)
->get('sendinblue_put_registered_user')['active'];
$sendinblue_registered_list = $configFactory
->get(SendinblueManager::CONFIG_SETTINGS_REGISTERING_USER)
->get('sendinblue_put_registered_user')['list'];
if ($sendInBlueManager
->isLoggedInState() && $sendinblue_registered_active) {
$sendInBlueManager
->subscribeUser($user
->getEmail(), [
'nom' => $user
->getAccountName(),
], [
$sendinblue_registered_list,
]);
return;
}
}