]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/rest-api/fields/class-wp-rest-post-meta-fields.php
WordPress 4.7.2
[autoinstalls/wordpress.git] / wp-includes / rest-api / fields / class-wp-rest-post-meta-fields.php
1 <?php
2 /**
3  * REST API: WP_REST_Post_Meta_Fields class
4  *
5  * @package WordPress
6  * @subpackage REST_API
7  * @since 4.7.0
8  */
9
10 /**
11  * Core class used to manage meta values for posts via the REST API.
12  *
13  * @since 4.7.0
14  *
15  * @see WP_REST_Meta_Fields
16  */
17 class WP_REST_Post_Meta_Fields extends WP_REST_Meta_Fields {
18
19         /**
20          * Post type to register fields for.
21          *
22          * @since 4.7.0
23          * @access protected
24          * @var string
25          */
26         protected $post_type;
27
28         /**
29          * Constructor.
30          *
31          * @since 4.7.0
32          * @access public
33          *
34          * @param string $post_type Post type to register fields for.
35          */
36         public function __construct( $post_type ) {
37                 $this->post_type = $post_type;
38         }
39
40         /**
41          * Retrieves the object meta type.
42          *
43          * @since 4.7.0
44          * @access protected
45          *
46          * @return string The meta type.
47          */
48         protected function get_meta_type() {
49                 return 'post';
50         }
51
52         /**
53          * Retrieves the type for register_rest_field().
54          *
55          * @since 4.7.0
56          * @access public
57          *
58          * @see register_rest_field()
59          *
60          * @return string The REST field type.
61          */
62         public function get_rest_field_type() {
63                 return $this->post_type;
64         }
65 }