-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathModule7.php
More file actions
76 lines (63 loc) · 2.34 KB
/
Module7.php
File metadata and controls
76 lines (63 loc) · 2.34 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
<?php
namespace DrupalCodeBuilder\Generator;
use DrupalCodeBuilder\Definition\PropertyListInterface;
use DrupalCodeBuilder\Definition\PropertyDefinition;
use DrupalCodeBuilder\Definition\DeferredGeneratorDefinition;
use DrupalCodeBuilder\Definition\MergingGeneratorDefinition;
/**
* Drupal 7 version of component.
*/
class Module7 extends Module8 {
/**
* {@inheritdoc}
*/
public static function configurationDefinition(): PropertyDefinition {
return PropertyDefinition::create('complex');
}
/**
* {@inheritdoc}
*/
public static function addToGeneratorDefinition(PropertyListInterface $definition) {
parent::addToGeneratorDefinition($definition);
$definition->removeProperty('plugins');
$definition->removeProperty('plugin_types');
$definition->removeProperty('services');
$definition->removeProperty('event_subscribers');
$definition->removeProperty('service_provider');
$definition->removeProperty('phpunit_tests');
$definition->getProperty('tests')->setDescription('');
$definition->removeProperty('config_entity_types');
$definition->removeProperty('drush_commands');
// TODO: implement these for D7.
$definition->removeProperty('content_entity_types');
$definition->removeProperty('theme_hooks');
$definition->removeProperty('forms');
$definition->addProperties([
'router_items' => DeferredGeneratorDefinition::createFromGeneratorType('RouterItem', 'string')
->setLabel("Menu paths")
->setDescription("Paths for hook_menu(), eg 'path/foo'")
->setMultiple(TRUE),
'settings_form' => DeferredGeneratorDefinition::createFromGeneratorType('AdminSettingsForm', 'boolean')
->setLabel("Admin settings form")
->setDescription("A form for setting the module's general settings. Also produces a permission and a menu item."),
]);
}
/**
* {@inheritdoc}
*/
public static function rootComponentPropertyDefinitionAlter(PropertyDefinition $definition): void {
// Do nothing.
}
/**
* {@inheritdoc}
*/
public function requiredComponents(): array {
$components = parent::requiredComponents();
// On D7 and lower, modules need a .module file, even if empty.
$components['%module.module'] = [
'component_type' => 'ExtensionCodeFile',
'filename' => '%module.module',
];
return $components;
}
}