PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.1.4.2
Pods – Custom Content Types and Fields v3.1.4.2
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / src / Pods / REST / V1 / Endpoints / Group_Slug.php
pods / src / Pods / REST / V1 / Endpoints Last commit date
Base.php 3 weeks ago Field.php 3 weeks ago Field_Slug.php 3 weeks ago Fields.php 3 weeks ago Group.php 3 weeks ago Group_Slug.php 3 weeks ago Groups.php 3 weeks ago Pod.php 3 weeks ago Pod_Slug.php 3 weeks ago Pods.php 3 weeks ago Swagger_Documentation.php 3 weeks ago
Group_Slug.php
149 lines
1 <?php
2
3 namespace Pods\REST\V1\Endpoints;
4
5 use WP_REST_Request;
6
7 class Group_Slug extends Group {
8
9 /**
10 * {@inheritdoc}
11 *
12 * @since 2.8.0
13 */
14 public $route = '/pods/%1$s/groups/%2$s';
15
16 /**
17 * {@inheritdoc}
18 *
19 * @since 2.8.11
20 */
21 public $rest_route = '/pods/(?P<pod>[\w\_\-]+)/groups/(?P<slug>[\w\_\-]+)';
22
23 /**
24 * {@inheritdoc}
25 *
26 * @since 2.8.11
27 */
28 public $rest_doc_route = '/pods/{pod}/groups/{slug}';
29
30 /**
31 * {@inheritdoc}
32 *
33 * @since 2.8.0
34 */
35 public function READ_args() {
36 return [
37 'pod' => [
38 'type' => 'string',
39 'in' => 'path',
40 'description' => __( 'The Pod slug.', 'pods' ),
41 'required' => true,
42 'validate_callback' => [ $this->validator, 'is_pod_slug' ],
43 ],
44 'slug' => [
45 'type' => 'string',
46 'in' => 'path',
47 'description' => __( 'The Group slug.', 'pods' ),
48 'required' => true,
49 ],
50 'include_fields' => [
51 'type' => 'boolean',
52 'description' => __( 'Whether to include fields (default: off).', 'pods' ),
53 'default' => false,
54 'cli_boolean' => true,
55 ],
56 ];
57 }
58
59 /**
60 * {@inheritdoc}
61 *
62 * @since 2.8.0
63 */
64 public function get( WP_REST_Request $request ) {
65 return $this->get_by_args( 'slug', 'name', $request );
66 }
67
68 /**
69 * {@inheritdoc}
70 *
71 * @since 2.8.0
72 */
73 public function EDIT_args() {
74 return [
75 'pod' => [
76 'type' => 'string',
77 'in' => 'path',
78 'description' => __( 'The Pod slug.', 'pods' ),
79 'required' => true,
80 'validate_callback' => [ $this->validator, 'is_pod_slug' ],
81 ],
82 'slug' => [
83 'type' => 'string',
84 'in' => 'path',
85 'description' => __( 'The Field slug.', 'pods' ),
86 'required' => true,
87 ],
88 'new_name' => [
89 'type' => 'string',
90 'description' => __( 'The new name of the Group.', 'pods' ),
91 ],
92 'label' => [
93 'type' => 'string',
94 'description' => __( 'The singular label of the Group.', 'pods' ),
95 ],
96 'type' => [
97 'type' => 'string',
98 'description' => __( 'The type of the Group.', 'pods' ),
99 ],
100 'args' => [
101 'required' => false,
102 'description' => __( 'A list of additional options to save to the Group.', 'pods' ),
103 'swagger_type' => 'array',
104 ],
105 ];
106 }
107
108 /**
109 * {@inheritdoc}
110 *
111 * @since 2.8.0
112 */
113 public function update( WP_REST_Request $request ) {
114 return $this->update_by_args( 'slug', 'name', $request );
115 }
116
117 /**
118 * {@inheritdoc}
119 *
120 * @since 2.8.0
121 */
122 public function DELETE_args() {
123 return [
124 'pod' => [
125 'type' => 'string',
126 'in' => 'path',
127 'description' => __( 'The Pod slug.', 'pods' ),
128 'required' => true,
129 'validate_callback' => [ $this->validator, 'is_pod_slug' ],
130 ],
131 'slug' => [
132 'type' => 'string',
133 'in' => 'path',
134 'description' => __( 'The Group slug.', 'pods' ),
135 'required' => true,
136 ],
137 ];
138 }
139
140 /**
141 * {@inheritdoc}
142 *
143 * @since 2.8.0
144 */
145 public function delete( WP_REST_Request $request ) {
146 return $this->delete_by_args( 'slug', 'name', $request );
147 }
148 }
149