PHP 클래스 WP_REST_Meta_Fields, wordpress

부터: 4.7.0
파일 보기 프로젝트 열기: johnpbloch/wordpress

공개 메소드들

메소드 설명
get_field_schema ( ) : array Retrieves the object's meta schema, conforming to JSON Schema.
get_value ( integer $object_id, WP_REST_Request $request ) : WP_Error | object Retrieves the meta field value.
prepare_value ( mixed $value, WP_REST_Request $request, array $args ) : mixed Prepares a meta value for output.
register_field ( ) Registers the meta field.
update_value ( WP_REST_Request $request, integer $object_id ) : WP_Error | null Updates meta values.

보호된 메소드들

메소드 설명
delete_meta_value ( integer $object_id, string $meta_key, string $name ) : boolean | WP_Error Deletes a meta value for an object.
get_meta_type ( ) : string Retrieves the object meta type.
get_registered_fields ( ) : array Retrieves all the registered meta fields.
get_rest_field_type ( ) : string Retrieves the object type for register_rest_field().
prepare_value_for_response ( mixed $value, WP_REST_Request $request, array $args ) : mixed Prepares a meta value for a response.
update_meta_value ( integer $object_id, string $meta_key, string $name, mixed $value ) : boolean | WP_Error Updates a meta value for an object.
update_multi_meta_value ( integer $object_id, string $meta_key, string $name, array $values ) : boolean | WP_Error Updates multiple meta values for an object.

메소드 상세

delete_meta_value() 보호된 메소드

Deletes a meta value for an object.
부터: 4.7.0
protected delete_meta_value ( integer $object_id, string $meta_key, string $name ) : boolean | WP_Error
$object_id integer Object ID the field belongs to.
$meta_key string Key for the field.
$name string Name for the field that is exposed in the REST API.
리턴 boolean | WP_Error True if meta field is deleted, WP_Error otherwise.

get_field_schema() 공개 메소드

Retrieves the object's meta schema, conforming to JSON Schema.
부터: 4.7.0
public get_field_schema ( ) : array
리턴 array Field schema data.

get_meta_type() 추상적인 보호된 메소드

Retrieves the object meta type.
부터: 4.7.0
abstract protected get_meta_type ( ) : string
리턴 string One of 'post', 'comment', 'term', 'user', or anything else supported by `_get_meta_table()`.

get_registered_fields() 보호된 메소드

Retrieves all the registered meta fields.
부터: 4.7.0
protected get_registered_fields ( ) : array
리턴 array Registered fields.

get_rest_field_type() 추상적인 보호된 메소드

Retrieves the object type for register_rest_field().
부터: 4.7.0
abstract protected get_rest_field_type ( ) : string
리턴 string The REST field type, such as post type name, taxonomy name, 'comment', or `user`.

get_value() 공개 메소드

Retrieves the meta field value.
부터: 4.7.0
public get_value ( integer $object_id, WP_REST_Request $request ) : WP_Error | object
$object_id integer Object ID to fetch meta for.
$request WP_REST_Request Full details about the request.
리턴 WP_Error | object Object containing the meta values by name, otherwise WP_Error object.

prepare_value() 공개 정적인 메소드

Default preparation for meta fields. Override by passing the prepare_callback in your show_in_rest options.
부터: 4.7.0
public static prepare_value ( mixed $value, WP_REST_Request $request, array $args ) : mixed
$value mixed Meta value from the database.
$request WP_REST_Request Request object.
$args array REST-specific options for the meta key.
리턴 mixed Value prepared for output. If a non-JsonSerializable object, null.

prepare_value_for_response() 보호된 메소드

This is required because some native types cannot be stored correctly in the database, such as booleans. We need to cast back to the relevant type before passing back to JSON.
부터: 4.7.0
protected prepare_value_for_response ( mixed $value, WP_REST_Request $request, array $args ) : mixed
$value mixed Meta value to prepare.
$request WP_REST_Request Current request object.
$args array Options for the field.
리턴 mixed Prepared value.

register_field() 공개 메소드

Registers the meta field.
또한 보기: register_rest_field()
부터: 4.7.0
public register_field ( )

update_meta_value() 보호된 메소드

Updates a meta value for an object.
부터: 4.7.0
protected update_meta_value ( integer $object_id, string $meta_key, string $name, mixed $value ) : boolean | WP_Error
$object_id integer Object ID to update.
$meta_key string Key for the custom field.
$name string Name for the field that is exposed in the REST API.
$value mixed Updated value.
리턴 boolean | WP_Error True if the meta field was updated, WP_Error otherwise.

update_multi_meta_value() 보호된 메소드

Alters the list of values in the database to match the list of provided values.
부터: 4.7.0
protected update_multi_meta_value ( integer $object_id, string $meta_key, string $name, array $values ) : boolean | WP_Error
$object_id integer Object ID to update.
$meta_key string Key for the custom field.
$name string Name for the field that is exposed in the REST API.
$values array List of values to update to.
리턴 boolean | WP_Error True if meta fields are updated, WP_Error otherwise.

update_value() 공개 메소드

Updates meta values.
부터: 4.7.0
public update_value ( WP_REST_Request $request, integer $object_id ) : WP_Error | null
$request WP_REST_Request Full details about the request.
$object_id integer Object ID to fetch meta for.
리턴 WP_Error | null WP_Error if one occurs, null on success.