forked from hechoendrupal/drupal-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntityContentGenerator.php
More file actions
122 lines (104 loc) · 3.65 KB
/
Copy pathEntityContentGenerator.php
File metadata and controls
122 lines (104 loc) · 3.65 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/**
* @file
* Contains \Drupal\AppConsole\Generator\EntityContentGenerator.
*/
namespace Drupal\AppConsole\Generator;
class EntityContentGenerator extends Generator
{
/**
* Generator Entity
*
* @param string $module Module name
* @param string $entity_name Entity machine name
* @param string $entity_class Entity class name
*/
public function generate($module, $entity_name, $entity_class)
{
$parameters = [
'module' => $module,
'entity_name' => $entity_name,
'entity_class' => $entity_class,
];
$this->renderFile(
'module/routing-entity-content.yml.twig',
$this->getModulePath($module) . '/' . $module . '.routing.yml',
$parameters,
FILE_APPEND
);
$this->renderFile(
'module/links.menu-entity-content.yml.twig',
$this->getModulePath($module) . '/' . $module . '.links.menu.yml',
$parameters,
FILE_APPEND
);
$this->renderFile(
'module/links.task-entity-content.yml.twig',
$this->getModulePath($module) . '/' . $module . '.links.task.yml',
$parameters,
FILE_APPEND
);
$this->renderFile(
'module/links.action-entity-content.yml.twig',
$this->getModulePath($module) . '/' . $module . '.links.action.yml',
$parameters,
FILE_APPEND
);
$this->renderFile(
'module/src/interface-entity-content.php.twig',
$this->getSourcePath($module) . '/' . $entity_class . 'Interface.php',
$parameters
);
$this->renderFile(
'module/src/accesscontrolhandler-entity-content.php.twig',
$this->getSourcePath($module) . '/' . $entity_class . 'AccessControlHandler.php',
$parameters
);
$this->renderFile(
'module/src/Entity/entity-content.php.twig',
$this->getEntityPath($module) . '/' . $entity_class . '.php',
$parameters
);
$this->renderFile(
'module/src/Entity/entity-content-views-data.php.twig',
$this->getEntityPath($module) . '/' . $entity_class . 'ViewsData.php',
$parameters
);
$this->renderFile(
'module/src/Entity/Controller/listcontroller-entity-content.php.twig',
$this->getEntityPath($module) . '/Controller/' . $entity_class . 'ListController.php',
$parameters
);
$this->renderFile(
'module/src/Entity/Form/entity-settings.php.twig',
$this->getEntityPath($module) . '/Form/' . $entity_class . 'SettingsForm.php',
$parameters
);
$this->renderFile(
'module/src/Entity/Form/entity-content.php.twig',
$this->getEntityPath($module) . '/Form/' . $entity_class . 'Form.php',
$parameters
);
$this->renderFile(
'module/src/Entity/Form/entity-content-delete.php.twig',
$this->getEntityPath($module) . '/Form/' . $entity_class . 'DeleteForm.php',
$parameters
);
$this->renderFile(
'module/entity-content-page.php.twig',
$this->getModulePath($module) . '/' . $entity_name . '.page.inc',
$parameters
);
$this->renderFile(
'module/templates/entity-html.twig',
$this->getTemplatePath($module) . '/' . $entity_name . '.html.twig',
$parameters
);
$content = $this->renderView(
'module/src/Entity/entity-content.theme.php.twig',
$parameters
);
echo 'Add this to your hook_theme:' . PHP_EOL;
echo $content;
}
}