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;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\editor\Entity\Editor;
use Drupal\Core\Extension\ModuleExtensionList;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Defines the "detail" plugin.
@@ -19,6 +21,30 @@ use Drupal\editor\Entity\Editor;
*/
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}
@@ -33,7 +59,7 @@ class Detail extends CKEditorPluginBase {
return [
'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 {
public function getFile() {
// Make sure that the path to the plugin.js matches the file structure of
// 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