It is not possible to override AiTranslator methods

Created on 13 March 2025, 25 days ago

Problem/Motivation

When I try to override the Drupal\ai_tmgmt\Plugin\tmgmt\Translator\AiTranslator class.
We encountered the problem that it has explicitly defined classes, which does not allow us to override some batch methods.

Steps to reproduce

  1. Create your own plugin that inherits Drupal\ai_tmgmt\Plugin\tmgmt\Translator\AiTranslator.
  2. Override the batch or doRequest method.
  3. Create Providers in admin/tmgmt/translators/manage
  4. Select your plugin in Provider plugin
  5. Then start the translation (create a job with your provider).

Your method is expected to be called

In fact, the parent method is called

Proposed resolution

In order to fix this, need to replace the AiTranslator::class call with static::class.

That's what this patch does

Feature request
Status

Active

Version

1.0

Component

Code

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024