Error: Call to undefined function Drupal\entity_tasks\Plugin\Block\drupal_get_path()

Created on 27 September 2023, 9 months ago
Updated 28 September 2023, 9 months ago

Problem/Motivation

While utilizing the entity_tasks module on Drupal 10 and PHP 8.1, an error was detected related to a deprecated function. The error throws a message indicating an undefined function called from within the EntityTasksBlock class.

Error: Call to undefined function Drupal\entity_tasks\Plugin\Block\drupal_get_path() in Drupal\entity_tasks\Plugin\Block\EntityTasksBlock->build() (line 124 of modules/contrib/entity_tasks/src/Plugin/Block/EntityTasksBlock.php). 

To fix this, the old function call needs to be replaced with the updated method of getting the module's path. The new approach involves calling a service provided by Drupal:


\Drupal::service('extension.list.module')->getPath('entity_task')

🐛 Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

🇦🇷Argentina nexonOSX

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

Comments & Activities

Production build 0.69.0 2024