ACF_Rest_Api::build_schema_from_field_groups
Build the ACF schema scaffold and populate its properties from the given field groups. Shared between the type-level get_schema() and the per-object build_per_object_schema() so both surfaces stay in lockstep.
Метод класса: ACF_Rest_Api{}
Хуков нет.
Возвращает
array.
Использование
// private - только в коде основоного (родительского) класса $result = $this->build_schema_from_field_groups( $field_groups, $object_id );
- $field_groups(массив) (обязательный)
- Field groups to walk.
- $object_id(int|строка|null)
- Object ID passed to get_fields() so field-level filters see the target.
По умолчанию:null
Список изменений
| С версии 6.8.10 | Введена. |
Код ACF_Rest_Api::build_schema_from_field_groups() ACF Rest Api::build schema from field groups ACF 6.8.11
private function build_schema_from_field_groups( array $field_groups, $object_id = null ) {
$schema = array(
'description' => 'ACF field data',
'type' => 'object',
'properties' => array(),
'arg_options' => array(
'validate_callback' => array( $this, 'validate_rest_arg' ),
),
);
foreach ( $field_groups as $field_group ) {
foreach ( $this->get_fields( $field_group, $object_id ) as $field ) {
$schema['properties'][ $field['name'] ] = acf_get_field_rest_schema( $field );
}
}
return $schema;
}