Registers the settings for this page in the WordPress REST API.
Description
Source
File: src/db-objects/forms/form-settings-page.php
public function register_rest_api_settings() { $this->add_page_content(); foreach ( $this->tabs as $id => $tab_args ) { $setting_args = array( 'type' => 'object', 'description' => $tab_args['rest_description'], 'show_in_rest' => array( 'schema' => array( 'type' => 'object', 'properties' => array(), ), ), 'default' => array(), ); foreach ( $tab_args['field_manager']->get_fields() as $field ) { if ( ! isset( $this->sections[ $field->section ] ) ) { continue; } if ( ! isset( $this->subtabs[ $this->sections[ $field->section ]['subtab'] ] ) ) { continue; } $setting_args['show_in_rest']['schema']['properties'][ $field->id ] = $this->build_rest_schema_for_field( $field ); $setting_args['default'][ $field->id ] = $this->get_rest_default_for_field( $field ); } if ( empty( $setting_args['show_in_rest']['schema']['properties'] ) ) { $setting_args['show_in_rest'] = false; } register_setting( $id, $id, $setting_args ); add_filter( "sanitize_option_{$id}", array( $this, 'validate' ), 10, 2 ); } }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |