outlook_calendar-8.x-4.1/outlook_calendar.install
outlook_calendar.install
<?php
/**
* @file
* Install, update, and uninstall functions for the Outlook events module.
*/
/**
* Implements hook_schema().
*/
function outlook_calendar_schema() {
$schema['outlook_calendar'] = [
'fields' => [
'id' => [
'type' => 'serial',
'not null' => TRUE,
],
'mail' => [
'type' => 'varchar',
'description' => 'Outlook Account unique id of the user',
'length' => 40,
'not null' => TRUE,
],
'password' => [
'type' => 'varchar',
'description' => 'Password of the user outlook account',
'length' => 40,
'not null' => TRUE,
],
'uid' => [
'type' => 'int',
'description' => 'unique id of the user',
'length' => 6,
'not null' => TRUE,
],
],
'primary key' => ['id'],
];
return $schema;
}
/**
* Implements hook_unistall().
*/
function outlook_calendar_uninstall() {
$ids = \Drupal::entityQuery('node')
->condition('status', 1)
->condition('type', 'outlook_events')
->execute();
$storage_handler = \Drupal::entityTypeManager()->getStorage('node');
$entities = $storage_handler->loadMultiple($ids);
$storage_handler->delete($entities);
$content_type = \Drupal::entityTypeManager()->getStorage('node_type')->load('outlook_events');
$content_type->delete();
}
