1. Go to this page and download the library: Download bangpound/drupal-bootstrap library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bangpound / drupal-bootstrap example snippets
define('DRUPAL_ROOT', getcwd());
// Autoloading for Drush from the Drupal root's composer.json and vendor directory.
diff
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 9f37dfc..28566ea 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -2202,11 +2202,26 @@ function drupal_anonymous_user() {
* @param boolean $new_phase
* A boolean, set to FALSE if calling drupal_bootstrap from inside a
* function called from drupal_bootstrap (recursion).
+ * @param Drupal\Core\BootstrapInterface $object
+ * Drupal Bootstrap object.
*
* @return int
* The most recently completed phase.
*/
-function drupal_bootstrap($phase = NULL, $new_phase = TRUE) {
+function drupal_bootstrap($phase = NULL, $new_phase = TRUE, \Drupal\Core\BootstrapInterface $object = NULL) {
+
+ /** @var \Drupal\Core\BootstrapInterface $bootstrap */
+ static $bootstrap = NULL;
+
+ // On the first call, bootstrap object does not exist yet.
+ if (!isset($bootstrap)) {
+ if (!isset($object)) {
+ // If no bootstrap object is injected, use default bootstrap.
+ $object = new \Drupal\Core\Bootstrap();
+ }
+ $bootstrap = $object;
+ }
+
// Not drupal_static(), because does not depend on any run-time information.
static $phases = array(
DRUPAL_BOOTSTRAP_CONFIGURATION,
@@ -2243,41 +2258,7 @@ function drupal_bootstrap($phase = NULL, $new_phase = TRUE) {
$stored_phase = $current_phase;
}
- switch ($current_phase) {
- case DRUPAL_BOOTSTRAP_CONFIGURATION:
- _drupal_bootstrap_configuration();
- break;
-
- case DRUPAL_BOOTSTRAP_PAGE_CACHE:
- _drupal_bootstrap_page_cache();
- break;
-
- case DRUPAL_BOOTSTRAP_DATABASE:
- _drupal_bootstrap_database();
- break;
-
- case DRUPAL_BOOTSTRAP_VARIABLES:
- _drupal_bootstrap_variables();
- break;
-
- case DRUPAL_BOOTSTRAP_SESSION:
-
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.