Skip to content
Snippets Groups Projects
Commit 9edd7195 authored by mvogel's avatar mvogel
Browse files

Issue #3296555 by Project Update Bot: Automated Drupal 10 compatibility fixes...

Issue #3296555 by Project Update Bot: Automated Drupal 10 compatibility fixes - dropping d8 support and adding d10
parent c171e179
No related branches found
No related tags found
No related merge requests found
name: Ajax Loader
type: module
description: 'Provides alternative ajax loaders/throbbers.'
core: '8.x'
core_version_requirement: ^8 || ^9
core_version_requirement: ^9 || ^10
package: 'User Interface'
configure: ajax_loader.settings
......@@ -8,7 +8,7 @@ use Drupal\Core\Routing\RouteMatchInterface;
function ajax_loader_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.ajax_loader':
$output = file_get_contents(drupal_get_path('module', 'ajax_loader') . '/README.txt');
$output = file_get_contents(\Drupal::service('extension.list.module')->getPath('ajax_loader') . '/README.txt');
return '<pre>' . $output . '</pre>';
}
}
......
......@@ -2,12 +2,15 @@
namespace Drupal\ajax_loader;
use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Plugin\PluginBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Class ThrobberBase.
*/
abstract class ThrobberPluginBase extends PluginBase implements ThrobberPluginInterface {
abstract class ThrobberPluginBase extends PluginBase implements ThrobberPluginInterface, ContainerFactoryPluginInterface {
protected $path;
protected $markup;
......@@ -25,14 +28,38 @@ abstract class ThrobberPluginBase extends PluginBase implements ThrobberPluginIn
* @param mixed $plugin_definition
* Plugin definition value.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, ModuleExtensionList $extensionList) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->path = '/' . drupal_get_path('module', 'ajax_loader');
$this->path = '/' . $extensionList->getPath('ajax_loader');
$this->markup = $this->setMarkup();
$this->css_file = $this->setCssFile();
}
/**
* Creates an instance of the plugin.
*
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* The container to pull out services used in the plugin.
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin ID for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
*
* @return static
* Returns an instance of this plugin.
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('extension.list.module'),
);
}
/**
* Function to get markup.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment