forked from hechoendrupal/drupal-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPermissionGenerator.php
More file actions
39 lines (34 loc) · 896 Bytes
/
Copy pathPermissionGenerator.php
File metadata and controls
39 lines (34 loc) · 896 Bytes
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
<?php
/**
* @file
* Contains Drupal\AppConsole\Generator\PermissionGenerator.
*/
namespace Drupal\AppConsole\Generator;
class PermissionGenerator extends Generator
{
/**
* @param $module
* @param $permission
*/
public function generate($module, $permissions)
{
$parameters = array(
'module_name' => $module,
'permissions' => $permissions,
);
$this->renderFile(
'module/permission.yml.twig',
$this->getModulePath($module).'/'.$module.'.permissions.yml',
$parameters,
FILE_APPEND
);
$content = $this->renderView(
'module/permission-routing.yml.twig',
$parameters
);
if ($this->isLearning()) {
echo 'You can use this permission in the routing file like this:'.PHP_EOL;
echo $content;
}
}
}