Abilities final class
Minn\Runtime\Abilities · public/minn/src/Minn/Runtime/Abilities.php · 226 lines
The abilities registry behind WP_Abilities_Registry, WP_Ability_Categories_Registry and the wp_*_ability facade, as the reference keeps it (probes abilities-registry, abilities-classes). The categories init and then the abilities init fire once each, lazily, on the first lookup of their kind, each handed its registry. The registries themselves take a registration at any time; only the wp_register_* functions insist on the init action. A registration is checked as the reference checks it (name shape, duplicates, a known category, then the properties the ability and category classes check) and refused with its notice. An ability's meta gains the default annotations, show_in_rest (public's value when unset) and public.
Constants and properties
| private | STATE = 'abilities' | |
| private | CATEGORIES = 'WP_Ability_Categories_Registry' | |
| private | ABILITIES = 'WP_Abilities_Registry' | |
| private | NAME = '/^[a-z0-9-]+\\/[a-z0-9-]+$/' | |
| private | SLUG = '/^[a-z0-9]+(?:-[a-z0-9]+)*$/' | |
| private | ANNOTATIONS = array ( 'readonly' => NULL, 'destructive' => NULL, 'idempotent' => NULL, ) |
Public
| static | initializeCategories(): void# | Fires the categories action once. | |||
| static | initialize(): void# | Fires the categories action, then the abilities action, each once. | |||
| static | registerCategory(string $slug, array $args): ?array# | Registers a category; its row, or null with the reference's notice. @return array<string, mixed>|null @return array<string, mixed>|null | |||
| static | register(string $name, array $args): ?array# | Registers an ability; its row, or null with the reference's notice. @return array<string, mixed>|null @return array<string, mixed>|null | |||
| static | unregister(string $name): ?array# | Removes an ability; its row, or null with the reference's notice. @return array<string, mixed>|null @return array<string, mixed>|null | |||
| static | unregisterCategory(string $slug): ?array# | Removes a category; its row, or null with the reference's notice. @return array<string, mixed>|null @return array<string, mixed>|null | |||
| static | find(string $name): ?array# | One ability, or null with the reference's notice. @return array<string, mixed>|null @return array<string, mixed>|null | |||
| static | ability(string $name): ?array# | One ability, or null, asked after without a notice. @return array<string, mixed>|null @return array<string, mixed>|null | |||
| static | findCategory(string $slug): ?array# | One category, or null with the reference's notice. @return array<string, mixed>|null @return array<string, mixed>|null | |||
| static | category(string $slug): ?array# | One category, or null, asked after without a notice. @return array<string, mixed>|null @return array<string, mixed>|null | |||
| static | all(): array# | Every ability, by name. @return array<string, array> @return array<string, array> | |||
| static | allCategories(): array# | Every category, by slug. @return array<string, array> @return array<string, array> | |||
| static | abilityRefusal(array $args): ?string# | Why an ability's properties are refused, as WP_Ability::prepare_properties says it, or null. @param array<string, mixed> $args
| |||
| static | categoryRefusal(array $args): ?string# | Why a category's properties are refused, as WP_Ability_Category::prepare_properties says it, or null. @param array<string, mixed> $args
| |||
| static | meta(array $meta): array# | An ability's meta with the reference's defaults: the three annotations first, show_in_rest (public's value when unset), then public. @return array<string, mixed> |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
Nothing matches.