Skip to content
Snippets Groups Projects

Issue #3073808 - Fix deprecated methods

1 file
+ 7
4
Compare changes
  • Side-by-side
  • Inline
+ 7
4
@@ -5,16 +5,19 @@
* Adds conditional CSS from the .info file.
*/
use \Drupal\Component\Utility\Unicode;
use Drupal\Core\Asset\AttachedAssetsInterface;
/**
* Implements hook_css_alter().
*/
function conditional_styles_css_alter(&$css, \Drupal\Core\Asset\AttachedAssetsInterface $assets) {
function conditional_styles_css_alter(&$css, AttachedAssetsInterface $assets) {
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
$theme_handler = \Drupal::service('theme_handler');
$current_theme = $theme_handler->getDefault();
$path = drupal_get_path('theme', $current_theme);
$path = \Drupal::service('extension.list.theme')->getPath($current_theme);
$info = $theme_handler->getTheme($current_theme)->info;
if (!empty($info['conditional-stylesheets'])) {
foreach ($info['conditional-stylesheets'] as $version => $media) {
foreach ($media as $key => $file_path) {
@@ -29,7 +32,7 @@ function conditional_styles_css_alter(&$css, \Drupal\Core\Asset\AttachedAssetsIn
'every_page' => TRUE,
'browsers' => [
'IE' => $version,
'!IE' => (Unicode::strpos($version, '!IE') !== FALSE),
'!IE' => (mb_strpos($version, '!IE') !== FALSE),
],
];
}
Loading