Error: Call to undefined function Drupal\ckeditor_markdown\Plugin\CKEditorPlugin\drupal_get_path() in Drupal\ckeditor_markdown\Plugin\CKEditorPlugin\Markdown->getButtons() (line 22 of ../contrib/ckeditor_markdown/src/Plugin/CKEditorPlugin/Markdown.php).

Created on 6 December 2023, over 1 year ago

Problem/Motivation

Getting error when trying to edit a node utilizing the ckeditor_markdown module

Steps to reproduce

  • Install Drupal 10 (composer create-project drupal/recommended-project
  • Install ckeditor_markdown module (composer require drupal/ckeditor_markdown
  • In ckeditor, allow use of "Markdown"
  • create/edit a node (article or basic)

Proposed resolution

Code fix is needed

Specific error on "Recent Log Messages" page

Error: Call to undefined function Drupal\ckeditor_markdown\Plugin\CKEditorPlugin\drupal_get_path() in Drupal\ckeditor_markdown\Plugin\CKEditorPlugin\Markdown->getButtons() (line 22 of web/modules/contrib/ckeditor_markdown/src/Plugin/CKEditorPlugin/Markdown.php).

πŸ› Bug report
Status

Active

Version

1.3

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States xandermar Milton, Delaware

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @xandermar
  • πŸ‡ΊπŸ‡ΈUnited States xandermar Milton, Delaware

    Similar issue:

    https://www.drupal.org/project/commerce_pricelist/issues/3353428#:~:text... πŸ› Call to undefined function drupal_get_path() with D10 Fixed ()%20no%20longer%20exists%20with,be%20able%20to%20support%20D10.

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States xandermar Milton, Delaware

    Patch created that updates the code...

    diff --git a/src/Plugin/CKEditorPlugin/Markdown.php b/src/Plugin/CKEditorPlugin/Markdown.php
    index b5c771e..992cbab 100644
    --- a/src/Plugin/CKEditorPlugin/Markdown.php
    +++ b/src/Plugin/CKEditorPlugin/Markdown.php
    @@ -19,7 +19,7 @@ class Markdown extends CKEditorPluginBase {
        * {@inheritdoc}
        */
       public function getButtons() {
    -    $path = $this->getModulePath('ckeditor_markdown') . '/js/plugins/markdown';
    +    $path = \Drupal::service('extension.list.module')->getPath('ckeditor_markdown') . '/js/plugins/markdown';
         return [
           'Markdown' => [
             'label' => $this->t('Markdown'),
    @@ -32,7 +32,7 @@ class Markdown extends CKEditorPluginBase {
        * {@inheritdoc}
        */
       public function getFile() {
    -    return $this->getModulePath('ckeditor_markdown') . '/js/plugins/markdown/plugin.js';
    +    return \Drupal::service('extension.list.module')->getPath('ckeditor_markdown') . '/js/plugins/markdown/plugin.js';
       }
    
       /**
    
  • πŸ‡―πŸ‡΄Jordan mohammedOdeh

    Reroll the patch to version 1.3

  • Status changed to Closed: duplicate 5 months ago
  • πŸ‡§πŸ‡ͺBelgium JeroenT πŸ‡§πŸ‡ͺ
Production build 0.71.5 2024