Skip to content
Snippets Groups Projects
Commit efc0fd14 authored by Udit Rawat's avatar Udit Rawat Committed by Daniel Moberly
Browse files

Issue #3297258 by uditrawat: Automated Drupal 10 compatibility fixes

parent 83dcb188
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,9 @@
"issues": "https://drupal.org/project/issues/fontawesome",
"source": "https://git.drupalcode.org/project/fontawesome"
},
"require": {
"drupal/core": "^9.4 || ^10"
},
"extra": {
"drush": {
"services": {
......
......@@ -2,6 +2,5 @@ name: 'Font Awesome'
type: module
description: 'The most popular icon set and toolkit on the web.'
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^9.4 || ^10
configure: fontawesome.admin_settings
......@@ -333,7 +333,7 @@ function fontawesome_theme_registry_alter(&$theme_registry) {
* By default, Drupal 8 does not include theme suggestions from inside the
* module in which they were created, so we must add them manually here.
*/
$path = drupal_get_path('module', 'fontawesome');
$path = \Drupal::service('extension.list.module')->getPath('fontawesome');
$fontawesome_templates = drupal_find_theme_templates($theme_registry, '.html.twig', $path);
foreach ($fontawesome_templates as &$fontawesome_template) {
$fontawesome_template['type'] = 'module';
......
services:
fontawesome.font_awesome_manager:
class: Drupal\fontawesome\FontAwesomeManager
arguments: ['@cache.data', '@module_handler', '@theme_handler', '@file_system', '@http_client_factory']
arguments: ['@cache.data', '@module_handler', '@theme_handler', '@file_system', '@extension.list.module']
......@@ -2,7 +2,6 @@ name: 'Font Awesome Iconpicker Widget'
type: module
description: 'Provides an iconpicker widget for Font Awesome'
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^9.4 || ^10
dependencies:
- fontawesome:fontawesome
......@@ -2,8 +2,7 @@ name: 'Font Awesome Media Entity'
type: module
description: 'Adds a Font Awesome Media Entity Type.'
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^9.4 || ^10
dependencies:
- fontawesome:fontawesome
- drupal:svg_image
......@@ -2,6 +2,7 @@
namespace Drupal\fontawesome;
use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\File\FileSystemInterface;
......@@ -42,6 +43,13 @@ class FontAwesomeManager implements FontAwesomeManagerInterface {
*/
protected $fileSystem;
/**
* Module extension list.
*
* @var \Drupal\Core\Extension\ModuleExtensionList
*/
protected $moduleExtensionList;
/**
* Constructs a FontAwesomeManager object.
*
......@@ -54,11 +62,12 @@ class FontAwesomeManager implements FontAwesomeManagerInterface {
* @param \Drupal\Core\File\FileSystemInterface $file_system
* The file system helper.
*/
public function __construct(CacheBackendInterface $data_cache, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, FileSystemInterface $file_system) {
public function __construct(CacheBackendInterface $data_cache, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, FileSystemInterface $file_system, ModuleExtensionList $module_extension_list) {
$this->dataCache = $data_cache;
$this->moduleHandler = $module_handler;
$this->themeHandler = $theme_handler;
$this->fileSystem = $file_system;
$this->moduleExtensionList = $module_extension_list;
}
/**
......@@ -249,7 +258,7 @@ class FontAwesomeManager implements FontAwesomeManagerInterface {
$metadataFile = $this->fileSystem->realpath(DRUPAL_ROOT . '/libraries/fontawesome/metadata/categories.yml');
// If we can't load the local file, use the included module icons file.
if (!file_exists($metadataFile)) {
$metadataFile = drupal_get_path('module', 'fontawesome') . '/metadata/categories.yml';
$metadataFile = $this->moduleExtensionList->getPath('fontawesome') . '/metadata/categories.yml';
}
return $metadataFile;
}
......
......@@ -20,7 +20,7 @@ class DrupalFontAwesome extends CKEditorPluginBase {
* {@inheritdoc}
*/
public function getFile() {
return drupal_get_path('module', 'fontawesome') . '/js/plugins/drupalfontawesome/plugin.js';
return \Drupal::service('extension.list.module')->getPath('fontawesome') . '/js/plugins/drupalfontawesome/plugin.js';
}
/**
......@@ -48,7 +48,7 @@ class DrupalFontAwesome extends CKEditorPluginBase {
return [
'DrupalFontAwesome' => [
'label' => $this->t('Font Awesome'),
'image' => drupal_get_path('module', 'fontawesome') . '/js/plugins/drupalfontawesome/icons/drupalfontawesome.png',
'image' => \Drupal::service('extension.list.module')->getPath('fontawesome') . '/js/plugins/drupalfontawesome/icons/drupalfontawesome.png',
],
];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment