Skip to content
Snippets Groups Projects
Commit f08fe970 authored by Igor Biki's avatar Igor Biki
Browse files

Merge branch 'feature/ISTWCMS-4569-ebremner-twitter-code' into '8.x-1.x'

Feature/istwcms 4569 ebremner twitter code

See merge request !46
parents 4121384a 34895e6f
No related branches found
No related tags found
1 merge request!46Feature/istwcms 4569 ebremner twitter code
langcode: en langcode: en
status: true status: true
dependencies: { } dependencies: { }
id: inline_blockuw_cbl_twitter id: uw_lbb_twitter
block_id: 'inline_block:uw_cbl_twitter' block_id: uw_cbl_twitter
category: uw_bc_external_embeds category: uw_bc_external_embeds
label: Twitter label: Twitter
weight: 0 weight: -4
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/twitter.svg image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/twitter.svg
image_alt: '' image_alt: ''
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
namespace Drupal\uw_cfg_common\Plugin\CKEditorPlugin; namespace Drupal\uw_cfg_common\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase; use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\Core\File\FileSystem;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\editor\Entity\Editor; use Drupal\editor\Entity\Editor;
use Drupal\Core\Asset\LibrariesDirectoryFileFinder;
use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Defines the "mathjax" plugin. * Defines the "mathjax" plugin.
...@@ -13,7 +17,48 @@ use Drupal\editor\Entity\Editor; ...@@ -13,7 +17,48 @@ use Drupal\editor\Entity\Editor;
* label = @Translation("Mathjax") * label = @Translation("Mathjax")
* ) * )
*/ */
class MathJaxPlugin extends CKEditorPluginBase { class MathJaxPlugin extends CKEditorPluginBase implements ContainerFactoryPluginInterface {
/**
* Library file finder.
*
* @var \Drupal\Core\Asset\LibrariesDirectoryFileFinder
*/
protected $libFileFinder;
/**
* File system.
*
* @var \Drupal\Core\File\FileSystem
*/
protected $fileSystem;
/**
* Constructs a BlockComponentRenderArray object.
*
* @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.
* @param \Drupal\Core\Asset\LibrariesDirectoryFileFinder $libFileFinder
* The library file finder.
* @param \Drupal\Core\File\FileSystem $fileSystem
* The file system.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, LibrariesDirectoryFileFinder $libFileFinder, FileSystem $fileSystem) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->libFileFinder = $libFileFinder;
$this->fileSystem = $fileSystem;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container->get('library.libraries_directory_file_finder'), $container->get('file_system'));
}
/** /**
* {@inheritdoc} * {@inheritdoc}
...@@ -50,7 +95,7 @@ class MathJaxPlugin extends CKEditorPluginBase { ...@@ -50,7 +95,7 @@ class MathJaxPlugin extends CKEditorPluginBase {
return [ return [
'Mathjax' => [ 'Mathjax' => [
'label' => $this->t('Math'), 'label' => $this->t('Math'),
'image' => drupal_get_path('profile', 'uw_base_profile') . '/libraries/ckeditor-mathjax/icons/mathjax.png', 'image' => $this->fileSystem->realpath($this->libFileFinder->find('ckeditor-mathjax')) . '/icons/mathjax.png',
], ],
]; ];
} }
...@@ -59,7 +104,7 @@ class MathJaxPlugin extends CKEditorPluginBase { ...@@ -59,7 +104,7 @@ class MathJaxPlugin extends CKEditorPluginBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getFile() { public function getFile() {
return drupal_get_path('profile', 'uw_base_profile') . '/libraries/ckeditor-mathjax/plugin.js'; return $this->fileSystem->realpath($this->libFileFinder->find('ckeditor-mathjax')) . '/plugin.js';
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment