-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathAnnotationClass.php
More file actions
68 lines (57 loc) · 1.59 KB
/
AnnotationClass.php
File metadata and controls
68 lines (57 loc) · 1.59 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
<?php
namespace DrupalCodeBuilder\Generator;
use MutableTypedData\Definition\PropertyListInterface;
use DrupalCodeBuilder\Definition\PropertyDefinition;
use DrupalCodeBuilder\Generator\Render\DocBlock;
/**
* Generator for PHP class files that define a class annotation.
*/
class AnnotationClass extends PHPClassFile {
/**
* {@inheritdoc}
*/
public static function addToGeneratorDefinition(PropertyListInterface $definition) {
parent::addToGeneratorDefinition($definition);
$definition->addProperties([
// TODO: this is specific to plugins.
'plugin_relative_namespace' => PropertyDefinition::create('string')
->setAutoAcquiredFromRequester(),
]);
}
/**
* {@inheritdoc}
*/
protected function getClassDocBlock(): DocBlock {
$docblock = parent::getClassDocBlock();
$docblock->Annotation();
return $docblock;
}
/**
* {@inheritdoc}
*/
protected function collectSectionBlocks() {
// Set up properties.
// TODO: these properties are only for plugin annotations, but so far
// nothing else uses this generator.
$this->properties[] = $this->createPropertyBlock(
'id',
'string',
[
'docblock_first_line' => 'The plugin ID.',
'prefixes' => ['public'],
]
);
$this->properties[] = $this->createPropertyBlock(
'label',
'\Drupal\Core\Annotation\Translation',
[
'docblock_first_line' => 'The human-readable name of the plugin.',
'prefixes' => ['public'],
]
/*
// TODO: needs:
'@ingroup plugin_translatable',
*/
);
}
}