\Drupal calls should be avoided in classes, use dependency injection instead

Created on 11 July 2023, over 1 year ago
Updated 13 July 2023, over 1 year ago

Problem/Motivation

The global service call to the twig object in Infogram.php must be avoided.

Steps to reproduce

Run the phpcs command on the module.

Proposed resolution

Inject the twig service via DI.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

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

Comments & Activities

  • Issue created by @sidharth_soman
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sidharth_soman Bangalore

    I have implemented the DI. Please review.

  • Status changed to Needs work over 1 year ago
  • 🇵🇭Philippines kenyoOwen

    Hi sidharth_soman

    I applied your patch and it removes the dependency injection issue, but it adds an error. please see the screenshots attached.

    Thank you.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India mrinalini9 New Delhi

    Updated patch #2 by addressing #3, please review it.

    Thanks & Regards,
    Mrinalini

  • 🇮🇳India sidharth_soman Bangalore

    @kenyoOwen, @mrinalini9 - This issue is created solely for the implementation of the DI and its required testing. A separate ticket needs to be created for addressing the PHPCS issues once this is merged. There's no requirement to fix the 'line exceeds 80 characters' and other such issues here.

Production build 0.71.5 2024