acf_field::get_field_creation_schemapublicACF 6.8.0

Returns the JSON schema for creating this field type.

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

Хуков нет.

Возвращает

array. JSON Schema definition for this field type, or an empty array if none exists.

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

$acf_field = new acf_field();
$acf_field->get_field_creation_schema(): array;

Список изменений

С версии 6.8.0 Введена.

Код acf_field::get_field_creation_schema() ACF 6.8.8

public function get_field_creation_schema(): array {
	$schema = acf_get_field_json_schema( $this->name );

	if ( empty( $schema ) ) {
		$schema = array(
			'type'       => 'object',
			'properties' => array(
				'label' => array(
					'type'        => 'string',
					'description' => 'The label for the field',
					'minLength'   => 1,
					'required'    => true,
				),
				'type'  => array(
					'type'        => 'string',
					'enum'        => array( $this->name ),
					'description' => 'The field type',
					'required'    => true,
				),
			),
		);
	}

	return $schema;
}