Closed (fixed)
Project:
Views data export
Version:
8.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
22 Jan 2020 at 09:29 UTC
Updated:
16 Oct 2025 at 14:16 UTC
Jump to comment: Most recent
use dependency injection to avoid upgrade problems to newer version.
Example:
File : /src/Plugin/views/display/DataExport.php
use Drupal\Core\Utility\Token;
\Drupal::token()->replace($filename, ['view' => $view] instead use $this->token->replace[$filename, ['view' => $view]]
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
vernitComment #3
vernitComment #4
amateichuk commentedIn static methods we can't use dependency injection
Comment #5
benstallings commentedOK, but not all of the methods in that class are static! And the parent class already implements ContainerFactoryPluginInterface, so all we need to do is use the
$instance = parent::create()pattern.Comment #6
benstallings commentedwhoops, wrong version
Comment #8
benstallings commentedComment #9
steven jones commented@benstallings thanks for the effort here, but there are still some places where we're not using dependency injection in this class at least, specifically the usages of the token service originally raised in this issue.
Comment #10
steven jones commentedAh, but of course that's exactly where we can't use DI, because the methods are static.
Comment #12
steven jones commentedNice, thanks Ben.
Comment #14
steven jones commented