Yoast\WP\SEO\Abilities\User_Interface

Abilities_Integration::nullable_enum_schemaprivateYoast 1.0

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.

Метод класса: Abilities_Integration{}

Хуков нет.

Возвращает

Массив<Строку,. mixed> The input schema fragment.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->nullable_enum_schema( $allowed_values, $description ): array;
$allowed_values(массив) (обязательный)
.
$description(строка) (обязательный)
The field description.

Код Abilities_Integration::nullable_enum_schema() Yoast 28.3

private function nullable_enum_schema( array $allowed_values, string $description ): array {
	return [
		'type'        => [ 'string', 'null' ],
		'description' => $description,
		'enum'        => \array_merge( $allowed_values, [ '', null ] ),
	];
}