Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
ckeditor_advanced_tab
Commits
95503bfe
Verified
Commit
95503bfe
authored
Jan 10, 2022
by
apaderno
Committed by
apaderno
Jan 10, 2022
Browse files
Issue
#3257715
by apaderno: Log an error when the plugin.js file isn't found
parent
d6953e93
Changes
2
Hide whitespace changes
Inline
Side-by-side
ckeditor_advanced_tab.services.yml
0 → 100644
View file @
95503bfe
services
:
logger.channel.ckeditor_advanced_tab
:
parent
:
logger.channel_base
arguments
:
[
'
ckeditor_advanced_tab'
]
src/Plugin/CKEditorPlugin/CKEditorAdvancedTab.php
View file @
95503bfe
...
...
@@ -3,7 +3,10 @@
namespace
Drupal\ckeditor_advanced_tab\Plugin\CKEditorPlugin
;
use
Drupal\ckeditor\CKEditorPluginBase
;
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
use
Drupal\editor\Entity\Editor
;
use
Psr\Log\LoggerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
* Defines the "Advanced Tab" plugin.
...
...
@@ -13,22 +16,53 @@
* label = @Translation("Advanced Tab Dialog")
* )
*/
class
CKEditorAdvancedTab
extends
CKEditorPluginBase
{
class
CKEditorAdvancedTab
extends
CKEditorPluginBase
implements
ContainerFactoryPluginInterface
{
/**
* {@inheritdoc}
* The logger service.
*
* @var \Psr\Log\LoggerInterface
*/
p
ublic
function
getFile
()
{
p
rotected
$logger
;
$path
=
'libraries/ckeditor/plugins/dialogadvtab/plugin.js'
;
/**
* Constructs a new CKEditorAdvancedTab 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 array $plugin_definition
* The plugin implementation definition.
* @param \Psr\Log\LoggerInterface $logger
* A logger instance.
*/
public
function
__construct
(
array
$configuration
,
$plugin_id
,
array
$plugin_definition
,
LoggerInterface
$logger
)
{
parent
::
__construct
(
$configuration
,
$plugin_id
,
$plugin_definition
);
$this
->
logger
=
$logger
;
}
if
(
file_exists
(
$path
))
{
return
'libraries/ckeditor/plugins/dialogadvtab/plugin.js'
;
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
)
{
return
new
static
(
$configuration
,
$plugin_id
,
$plugin_definition
,
$container
->
get
(
'logger.channel.ckeditor_advanced_tab'
));
}
/**
* {@inheritdoc}
*/
public
function
getFile
()
{
$file
=
'libraries/ckeditor/plugins/dialogadvtab/plugin.js'
;
if
(
!
file_exists
(
$file
))
{
$this
->
logger
->
error
(
t
(
'The %file file cannot be found. Please follow the installation instructions given in the README.md file.'
,
[
'%file'
=>
$file
]
));
}
else
{
drupal_set_message
(
t
(
"The plugin.js file can't be found in libraries/ckeditor/plugins/dialogadvtab. Please check README for installation."
),
'error'
)
;
return
$file
;
}
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment