forked from hechoendrupal/drupal-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuthenticationProviderGenerator.php
More file actions
51 lines (46 loc) · 1.39 KB
/
Copy pathAuthenticationProviderGenerator.php
File metadata and controls
51 lines (46 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* @file
* Contains \Drupal\AppConsole\Generator\AuthenticationProviderGenerator.
*/
namespace Drupal\AppConsole\Generator;
class AuthenticationProviderGenerator extends Generator
{
/**
* Generator Plugin Block
* @param $module
* @param $class_name
*/
public function generate($module, $class_name)
{
$parameters = [
'module' => $module,
'class_name' => $class_name
];
$this->renderFile(
'module/src/Authentication/Provider/authentication-provider.php.twig',
$this->getAuthenticationPath($module, 'Provider') . '/' . $class_name . '.php',
$parameters
);
$parameters = [
'module' => $module,
'class_name' => 'Authentication\\Provider\\' . $class_name,
'service_name' => 'authentication.' . $module,
'services' => [
['name' => 'config.factory'],
['name' => 'entity.manager']
],
'file_exists' => file_exists($this->getModulePath($module) . '/' . $module . '.services.yml'),
'tags' => [
'name' => 'authentication_provider',
'priority' => '100'
],
];
$this->renderFile(
'module/services.yml.twig',
$this->getModulePath($module) . '/' . $module . '.services.yml',
$parameters,
FILE_APPEND
);
}
}