Problem/Motivation

FILE: ..._html_field/src/Plugin/Field/FieldFormatter/ReadonlyHtmlFieldFormatter.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
23 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
24 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
--------------------------------------------------------------------------------

FILE: ...adonly_html_field/src/Plugin/Field/FieldWidget/ReadonlyHtmlFieldWidget.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
24 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
25 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
38 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
39 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
--------------------------------------------------------------------------------

Time: 330ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig readonly_html_field/

Proposed resolution

Add dependency injection

Remaining tasks

Patch review.

Comments

urvashi_vora created an issue. See original summary.

kenyoowen’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new286.06 KB
new143.37 KB

Hi urvashi_vora

I applied patch dependency-injections.patch and confirmed that the Dependency injection issues mentioned are resolved. Please see the screenshots attached.

For your review.
Thank you.

akram zairig’s picture

Hello , i've tested the patch on comment #2 , it's working and respecting dependency injection.

  • b.khouy committed 26c8b808 on 1.0.x
    Fix: #3365003 - Use of dependency injection on field widget and...
b.khouy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks guys!
Patch has been committed, please update to the latest version of Readonly Html Field module.

b.khouy’s picture

Status: Fixed » Closed (fixed)