Skip to content
Snippets Groups Projects

fix deprecated code

1 file
+ 28
2
Compare changes
  • Side-by-side
  • Inline
@@ -4,6 +4,8 @@ namespace Drupal\lucidutil\Plugin\CKEditorPlugin;
@@ -4,6 +4,8 @@ namespace Drupal\lucidutil\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\editor\Entity\Editor;
use Drupal\editor\Entity\Editor;
 
use Drupal\Core\Extension\ModuleExtensionList;
 
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
/**
* Defines the "detail" plugin.
* Defines the "detail" plugin.
@@ -19,6 +21,30 @@ use Drupal\editor\Entity\Editor;
@@ -19,6 +21,30 @@ use Drupal\editor\Entity\Editor;
*/
*/
class Detail extends CKEditorPluginBase {
class Detail extends CKEditorPluginBase {
 
/**
 
* Provides a list of available modules.
 
*
 
* @var \Drupal\Core\Extension\ModuleExtensionList
 
*/
 
protected $service;
 
 
/**
 
* Class constructor.
 
*/
 
public function __construct(ModuleExtensionList $service) {
 
$this->service = $service;
 
}
 
 
/**
 
* {@inheritdoc}
 
*/
 
public static function create(ContainerInterface $container) {
 
// Instantiates this form class.
 
return new static(
 
// Load the service required to construct this class.
 
$container->get('extension.list.module')
 
);
 
}
/**
/**
* {@inheritdoc}
* {@inheritdoc}
@@ -33,7 +59,7 @@ class Detail extends CKEditorPluginBase {
@@ -33,7 +59,7 @@ class Detail extends CKEditorPluginBase {
return [
return [
'Detail' => [
'Detail' => [
'label' => t('Detail'),
'label' => t('Detail'),
'image' => drupal_get_path('module', 'lucidutil') . '/js/plugins/detail/icons/detail.png',
'image' => $this->service->getPath('lucidutil') . '/js/plugins/detail/icons/detail.png',
],
],
];
];
}
}
@@ -44,7 +70,7 @@ class Detail extends CKEditorPluginBase {
@@ -44,7 +70,7 @@ class Detail extends CKEditorPluginBase {
public function getFile() {
public function getFile() {
// Make sure that the path to the plugin.js matches the file structure of
// Make sure that the path to the plugin.js matches the file structure of
// the CKEditor plugin you are implementing.
// the CKEditor plugin you are implementing.
return drupal_get_path('module', 'lucidutil') . '/js/plugins/detail/plugin.js';
return $this->service->getPath('lucidutil') . '/js/plugins/detail/plugin.js';
}
}
/**
/**
Loading