WP_REST_Settings_Controller::get_item_schema
Retrieves the site setting schema, conforming to JSON Schema.
Метод класса: WP_REST_Settings_Controller{}
Хуков нет.
Возвращает
array. Item schema data.
Использование
$WP_REST_Settings_Controller = new WP_REST_Settings_Controller(); $WP_REST_Settings_Controller->get_item_schema();
Список изменений
| С версии 4.7.0 | Введена. |
Код WP_REST_Settings_Controller::get_item_schema() WP REST Settings Controller::get item schema WP 7.1.2
public function get_item_schema() {
if ( $this->schema ) {
return $this->add_additional_fields_schema( $this->schema );
}
$options = $this->get_registered_options();
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'settings',
'type' => 'object',
'properties' => array(),
);
foreach ( $options as $option_name => $option ) {
$schema['properties'][ $option_name ] = $option['schema'];
$schema['properties'][ $option_name ]['arg_options'] = array(
'sanitize_callback' => array( $this, 'sanitize_callback' ),
);
}
$this->schema = $schema;
return $this->add_additional_fields_schema( $this->schema );
}