D10 - PHP 8.1 - Error: Call to undefined function Drupal\paragraphs_features\Plugin\CKEditorPlugin\drupal_get_path()

Created on 8 May 2024, 9 months ago

Problem/Motivation

Solve the PHP error below:
Error: Call to undefined function Drupal\paragraphs_features\Plugin\CKEditorPlugin\drupal_get_path() in Drupal\paragraphs_features\Plugin\CKEditorPlugin\SplitText->getFile() (line 52 of /opt/drupal/web/sites/default/modules/contrib/paragraphs_features/src/Plugin/CKEditorPlugin/SplitText.php).

Steps to reproduce

Simple installation and use in Drupal 10.2.x

Proposed resolution

PHP code adjustments

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

-

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇧🇷Brazil gerson.analista

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

  • Issue created by @gerson.analista
  • Status changed to Closed: won't fix 9 months ago
  • 🇧🇷Brazil gerson.analista

    During the module update, files from the old version remained, which caused the error.

  • 🇮🇳India Pramod Birla

    paragraphs_features/src/Plugin/CKEditorPlugin/SplitText.php

    51 public function getFile() {
    52 - return drupal_get_path('module', 'paragraphs_features') . '/js/plugins/splittext/plugin.js';
    53 + return \Drupal::service('extension.path.resolver')->getPath('module', 'paragraphs_features') . '/js/plugins/splittext/plugin.js';
    54 }

Production build 0.71.5 2024