-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathFeature.php
More file actions
109 lines (99 loc) · 2.29 KB
/
Feature.php
File metadata and controls
109 lines (99 loc) · 2.29 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
<?php
/**
* Feature interface.
*
* @package WordPress\AI\Contracts
*/
declare( strict_types=1 );
namespace WordPress\AI\Contracts;
/**
* Interface for all features.
*
* Every feature must implement this interface to be registered in the system.
*
* @since 0.6.0
*/
interface Feature {
/**
* Gets the unique feature identifier.
*
* This should be a unique slug-style identifier (e.g., 'title-rewriter').
*
* @since 0.6.0
*
* @return non-empty-string Feature ID.
*/
public static function get_id(): string;
/**
* Gets the human-readable feature label.
*
* This should be a translated string suitable for display in the admin.
*
* @since 0.6.0
*
* @return non-empty-string Translated feature label.
*/
public function get_label(): string;
/**
* Gets the feature description.
*
* This should be a translated string explaining what the feature does.
*
* @since 0.6.0
*
* @return non-empty-string Translated feature description.
*/
public function get_description(): string;
/**
* Gets the feature category.
*
* Determines where the feature appears in the settings UI.
*
* @since 0.6.0
*
* @return non-empty-string The feature category.
*/
public function get_category(): string;
/**
* Gets the feature stability level.
*
* @since 0.6.0
*
* @return 'deprecated'|'experimental'|'stable'
*/
public function get_stability(): string;
/**
* Registers the feature's hooks and functionality.
*
* This method is called when the feature is initialized.
* Use this to add actions, filters, and set up the feature.
*
* @since 0.6.0
*/
public function register(): void;
/**
* Checks if the feature is currently enabled.
*
* @since 0.6.0
*
* @return bool True if enabled, false otherwise.
*/
public function is_enabled(): bool;
/**
* Gets field definitions with fully resolved option names.
*
* Returns an empty array when the feature has no custom settings.
*
* @since x.x.x
*
* @return array<int, array{
* id: string,
* label: string,
* type: string,
* default?: mixed,
* elements?: list<array{value: string, label: string}>,
* isValid?: array{min?: int, max?: int},
* }> Array of field definitions with full option names.
*/
public function get_settings_fields_metadata(): array;
}