Skip to content

Commit 2cb72c3

Browse files
committed
OEL-4511: Simpler functions.
1 parent b03a5c2 commit 2cb72c3

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/DrupalCompatibility.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Drupal\oe_bootstrap_theme;
66

77
use Drupal\Component\Utility\DeprecationHelper;
8+
use Drupal\Core\Extension\ThemeSettingsProvider;
89

910
/**
1011
* Handles Drupal core compatibility behaviors.
@@ -31,17 +32,8 @@ public static function themeGetSetting(string $setting, ?string $theme = NULL):
3132
return DeprecationHelper::backwardsCompatibleCall(
3233
\Drupal::VERSION,
3334
self::THEME_SETTINGS_PROVIDER_VERSION,
34-
static function () use ($setting, $theme): mixed {
35-
$settings_provider = \Drupal::service('Drupal\Core\Extension\ThemeSettingsProvider');
36-
if (is_object($settings_provider) && method_exists($settings_provider, 'getSetting')) {
37-
return $settings_provider->getSetting($setting, $theme);
38-
}
39-
40-
throw new \RuntimeException('ThemeSettingsProvider::getSetting() is not available.');
41-
},
42-
static function () use ($setting, $theme): mixed {
43-
return \theme_get_setting($setting, $theme);
44-
}
35+
fn () => \Drupal::service(ThemeSettingsProvider::class)->getSetting($setting, $theme),
36+
fn () =>\theme_get_setting($setting, $theme),
4537
);
4638
}
4739

0 commit comments

Comments
 (0)