Use dependency injection in the projects

Created on 10 May 2023, over 1 year ago

Problem/Motivation

As per Drupal best practises. "\Drupal calls should be avoided in classes, use dependency injection instead"

Steps to reproduce

SassCompileService.php
$cssfile = \Drupal::service('file_system')->saveData($css, $newCssFile, FileSystemInterface::EXISTS_REPLACE);
SassCompileConfigForm.php
\Drupal::service('sass_compile.sass_compile')->compileScssFiles($source, $destination);

Proposed resolution

Use dependency injection for following files.

SassCompileService.php
SassCompileConfigForm.php
SassCompileCommands.php

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India shashank5563 New Delhi

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

Comments & Activities

Production build 0.71.5 2024