Undefined function '_theme'

Created on 18 April 2024, 2 months ago
Updated 15 June 2024, 13 days ago

Problem/Motivation

PHPStorm identifies _theme() as an undefined function in ParserBase.php:

  protected function debug($data, $machine_name) {
    $name = $machine_name;
    if ($this->sources[$machine_name]['name']) {
      $name = $this->sources[$machine_name]['name'];
    }

    $output = '<strong>' . $name . ':</strong>';
    $data = is_array($data) ? $data : [$data];
    foreach ($data as $key => $value) {
      $data[$key] = Html::escape($value);
    }
    $output .= _theme('item_list', ['items' => $data]);
    $this->getMessenger()->addMessage($output);
  }

And again in feeds_ex.theme.inc:

  $output = _theme('table', [
    'header' => $element['#header'],
    'rows' => $rows,
    'attributes' => ['id' => $element['sources']['#id']],
  ]);
  $output .= \Drupal::service('renderer')->render($element);

I'm guessing this is a leftover from the Drupal 7 migration, but I don't understand how to fix this.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇯🇵Japan ptmkenny

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024