Verified Commit c9c95433 authored by Alberto Paderno's avatar Alberto Paderno Committed by Alberto Paderno
Browse files

Issue #3257953 by apaderno: When verifying the...

Issue #3257953 by apaderno: When verifying the libraries/ckeditor/plugins/dialogadvtab/plugin.js file exists, use the Drupal root directory path
parent 88f6be86
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ function ckeditor_advanced_tab_requirements($phase) {
  $requirements = [];

  if ($phase == 'install' || $phase == 'runtime') {
    $path = DRUPAL_ROOT . '/libraries/ckeditor/plugins/dialogadvtab/';
    $path = \Drupal::root() . '/libraries/ckeditor/plugins/dialogadvtab/';
    $t_args = [':plugin_url' => 'https://ckeditor.com/cke4/addon/dialogadvtab', ':directory' => $path];

    if (file_exists($path . 'plugin.js')) {
+13 −2
Original line number Diff line number Diff line
@@ -19,6 +19,13 @@
 */
class CKEditorAdvancedTab extends CKEditorPluginBase implements ContainerFactoryPluginInterface {

  /**
   * Drupal root directory.
   *
   * @var string
   */
  protected $root;

  /**
   * The logger service.
   *
@@ -35,13 +42,16 @@ class CKEditorAdvancedTab extends CKEditorPluginBase implements ContainerFactory
   *   The plugin_id for the plugin instance.
   * @param array $plugin_definition
   *   The plugin implementation definition.
   * @param string $root
   *   Drupal root directory.
   * @param \Psr\Log\LoggerInterface $logger
   *   A logger instance.
   * @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager
   *   The translation manager.
   */
  public function __construct(array $configuration, $plugin_id, array $plugin_definition, LoggerInterface $logger, TranslationInterface $translation_manager) {
  public function __construct(array $configuration, $plugin_id, array $plugin_definition, string $root, LoggerInterface $logger, TranslationInterface $translation_manager) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->root = $root;
    $this->logger = $logger;
    $this->setStringTranslation($translation_manager);
  }
@@ -52,6 +62,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $configuration, $plugin_id, $plugin_definition,
      $container->hasParameter('app.root') ? $container->getParameter('app.root') : $container->get('app.root'),
      $container->get('logger.channel.ckeditor_advanced_tab'),
      $container->get('string_translation')
    );
@@ -62,7 +73,7 @@ public static function create(ContainerInterface $container, array $configuratio
   */
  public function getFile() {
    $file = 'libraries/ckeditor/plugins/dialogadvtab/plugin.js';
    if (!file_exists($file)) {
    if (!file_exists($this->root . '/' . $file)) {
      $this->logger->error(
        'The %file file cannot be found. Please follow the installation instructions given in the README.md file.',
        ['%file' => $file]