acf_field::get_field_creation_schema
Returns the JSON schema for creating this field type.
Method of the class: acf_field{}
No Hooks.
Returns
Array. JSON Schema definition for this field type, or an empty array if none exists.
Usage
$acf_field = new acf_field(); $acf_field->get_field_creation_schema(): array;
Changelog
| Since 6.8.0 | Introduced. |
acf_field::get_field_creation_schema() acf field::get field creation schema code 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;
}