Yoast\WP\SEO\Abilities\User_Interface\Abilities
Update_Post_SEO_Data_Ability::nullable_enum_schema
Returns a nullable-string input schema constrained to a fixed set of allowed values.
Null and the empty string are always allowed on top of the enum so the field can be cleared, matching the patch-clear semantics of the other write fields.
Метод класса: Update_Post_SEO_Data_Ability{}
Хуков нет.
Возвращает
array<string, mixed>. The input schema fragment.
Использование
// private - только в коде основоного (родительского) класса $result = $this->nullable_enum_schema( $allowed_values, $description ): array;
- $allowed_values(array<int, string>) (обязательный)
- The allowed string values.
- $description(строка) (обязательный)
- The field description.
Код Update_Post_SEO_Data_Ability::nullable_enum_schema() Update Post SEO Data Ability::nullable enum schema Yoast 28.9
private function nullable_enum_schema( array $allowed_values, string $description ): array {
return [
'type' => [ 'string', 'null' ],
'description' => $description,
'enum' => \array_merge( $allowed_values, [ '', null ] ),
];
}