Use entity type label in forms, not hardcoded "consumer"

Created on 29 November 2023, 12 months ago
Updated 28 March 2024, 8 months ago

Problem/Motivation

We've renamed Consumers to API Client. This requires decorating the entity forms since the word "consumer" is hardcoded and does not follow Drupal core's patterns of fetching the entity type's label.

Steps to reproduce

Use entity build alter hook to change entity type label. Realize it's still hardcoded in the Consumer form and Make Default form.

Proposed resolution

Use the entity type label from the entity type definition.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mglaman WI, USA

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

Comments & Activities

  • Issue created by @mglaman
  • Status changed to Needs review 9 months ago
  • πŸ‡ΊπŸ‡¦Ukraine sickness29

    Now you are able to adjust labels like so and patch will take care of using those labels.

    /**
     * Implements hook_entity_type_alter().
     */
    function test_module_entity_type_alter(array &$entity_types) {
      if (isset($entity_types['consumer'])) {
        $entity_types['consumer']->set('label', t('Test'));
        $entity_types['consumer']->set('label_collection', t('Tests'));
        $entity_types['consumer']->set('label_singular', t('test'));
        $entity_types['consumer']->set('label_plural', t('tests'));
      }
    }
    
  • Status changed to Fixed 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States eojthebrave Minneapolis, MN

    This is a great addition. Thanks for working on cleaning up all the hard-coded text.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024