summaryrefslogtreecommitdiff
path: root/plugins/drupal8/drupal8.module
blob: 193ddb864b74b20a88ffa0b0749d7adb4f9eacaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

use Drupal\Core\DrupalKernel;

function drupal8_bootstrap($config) {
  define('DRUPAL_ROOT', $config['root_path']);
  $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
  require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
  require_once DRUPAL_ROOT . '/core/includes/common.inc';
  require_once __DIR__ . '/BridgeDrupal8.php';
  drupal_static('conf_path', "sites/{$config['site']}");
  drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
  $kernel = new DrupalKernel('prod', FALSE, NULL, cache('bootstrap'));
  $kernel->boot();
}

function drupal8_init($config) {
  drupal8_bootstrap($config);
  return new BridgeDrupal8();
}

function drupal8_session($config) {
  drupal8_bootstrap($config);
  return user_is_logged_in() ? $GLOBALS['user']->name : FALSE;
}