Deprecate node_type_get_names

Created on 7 July 2025, 5 days ago

Problem/Motivation

node_type_get_names is a procedural function that needs to move to OO code.

Proposed resolution

TBC, this is used by a lot of contrib so we need a replacement. We shouldn't add a new service for this.

One option would be to add a new method to NodeType, or ConfigEntityBundleBase that does a similar thing but more generically.

Remaining tasks

Agree on approach

API changes

node_type_get_names is deprecated

📌 Task
Status

Active

Version

11.0 🔥

Component

node system

Created by

🇦🇺Australia acbramley

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

Merge Requests

Comments & Activities

  • Issue created by @acbramley
  • 🇬🇧United Kingdom longwave UK

    Given the function is just

      return array_map(function ($bundle_info) {
        return $bundle_info['label'];
      }, \Drupal::service('entity_type.bundle.info')->getBundleInfo('node'));
    

    this could be added as a convenience method to EntityTypeBundleInfo so you can call e.g.

    $labels = \Drupal::service('entity_type.bundle.info')->getBundleLabels('node');
    
  • Merge request !12666Issue #3534587: Deprecate node_type_get_names → (Open) created by acbramley
  • 🇦🇺Australia acbramley

    I like that approach, adding a new method to an interface is always contentious but let's see.

  • Pipeline finished with Success
    4 days ago
    Total: 602s
    #542605
Production build 0.71.5 2024