Last active
June 21, 2022 10:05
-
-
Save vladdancer/7a06505e7b05e364882b5a1b9f354d0e to your computer and use it in GitHub Desktop.
Load PHP class from custom module within settings.php file #php #drupal8+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Load PHP class from custom module within settings.php file. | |
*/ | |
if (class_exists(ClassLoader::class)) { | |
$class_loader = new ClassLoader(); | |
$class_loader->addPsr4('Drupal\\mymodule\\', DRUPAL_ROOT . '/modules/custom/mymodule/src'); | |
$class_loader->register(); | |
} | |
if (!class_exists('Drupal\mymodule\MyModuleConstants')) { | |
return; | |
} | |
$some_constants = \Drupal\mymodule\MymoduleConstants::LEGACY_DB_KEY; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment