function drupal_static_reset
Same name and namespace in other branches
- 11.x core/includes/bootstrap.inc \drupal_static_reset()
- 10 core/includes/bootstrap.inc \drupal_static_reset()
- 9 core/includes/bootstrap.inc \drupal_static_reset()
- 8.9.x core/includes/bootstrap.inc \drupal_static_reset()
- 7.x includes/bootstrap.inc \drupal_static_reset()
Resets one or all centrally stored static variable(s).
Parameters
string $name: Name of the static variable to reset. Omit to reset all variables. Resetting all variables should only be used, for example, for running unit tests with a clean environment.
14 calls to drupal_static_reset()
- drupal_flush_all_caches in core/
includes/ common.inc - Re-initializes the entire system.
- FunctionalTestSetupTrait::prepareEnvironment in core/
lib/ Drupal/ Core/ Test/ FunctionalTestSetupTrait.php - Prepares the current environment for running the test.
- KernelTestBase::tearDown in core/
tests/ Drupal/ KernelTests/ KernelTestBase.php - ListItemBase::submitFieldStorageUpdate in core/
modules/ options/ src/ Plugin/ Field/ FieldType/ ListItemBase.php - Resets the static variable on field storage update.
- LocaleBuildTest::testBuildProjects in core/
modules/ locale/ tests/ src/ Kernel/ LocaleBuildTest.php - Checks if a list of translatable projects gets built.
1 string reference to 'drupal_static_reset'
- KernelTestBase::tearDown in core/
tests/ Drupal/ KernelTests/ KernelTestBase.php
File
-
core/
includes/ bootstrap.inc, line 428
Code
function drupal_static_reset($name = NULL) : void {
switch ($name) {
case 'locale_translation_get_projects':
@trigger_error('Calling drupal_static_reset() with "locale_translation_get_projects" as argument is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal::service(\'locale.project\')->resetCache() instead. See https://www.drupal.org/node/3569330', E_USER_DEPRECATED);
if (\Drupal::hasService('locale.project')) {
\Drupal::service('locale.project')->resetCache();
}
break;
case 'filter_formats':
@trigger_error("Using drupal_static_reset() with 'filter_formats' as argument is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. No replacement is provided. See https://www.drupal.org/node/3035368", E_USER_DEPRECATED);
break;
}
drupal_static($name, NULL, TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.