-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathModule9And10.php
More file actions
31 lines (25 loc) · 944 Bytes
/
Module9And10.php
File metadata and controls
31 lines (25 loc) · 944 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
<?php
namespace DrupalCodeBuilder\Generator;
use MutableTypedData\Definition\PropertyListInterface;
use DrupalCodeBuilder\Attribute\DrupalCoreVersion;
use DrupalCodeBuilder\Attribute\RelatedBaseClass;
/**
* Drupal 9 and 10 version of component.
*/
#[DrupalCoreVersion(10)]
#[DrupalCoreVersion(9)]
#[RelatedBaseClass('Module')]
class Module9And10 extends Module {
/**
* {@inheritdoc}
*/
public static function addToGeneratorDefinition(PropertyListInterface $definition) {
parent::addToGeneratorDefinition($definition);
// In Drupal 10 and lower, we can still generate OO hooks as long as they
// have legacy support. Remove the option for OO-only hooks.
$definition->getProperty('hook_implementation_type')->setOptionsArray([
'procedural' => 'Functions in procedural files, such as .module',
'oo_legacy' => 'Class methods on a Hooks class, with legacy support for Drupal core < 11.1',
]);
}
}