1 | <?php |
||
12 | class PostType extends Type implements Registerable |
||
13 | { |
||
14 | /** |
||
15 | * PostType Constructor |
||
16 | * |
||
17 | * @param stdClass $object The WordPress post type object |
||
18 | * |
||
19 | * @throws \InvalidArgumentException |
||
20 | */ |
||
21 | public function __construct($object) |
||
29 | |||
30 | /** |
||
31 | * Create a new instance using the post type slug. |
||
32 | * |
||
33 | * Loads an existing type, or returns a new builder for registering a new type. |
||
34 | * |
||
35 | * @param string $id The post type identifier |
||
36 | * |
||
37 | * @return static|Builder If the post type has been registered, a new static instance is returned. |
||
38 | * Otherwise a new Builder is created for building a new post type to register. |
||
39 | */ |
||
40 | public static function make($id) |
||
48 | |||
49 | /** |
||
50 | * Create a new instance from an existing type. |
||
51 | * |
||
52 | * @param string $id The post type identifier |
||
53 | * |
||
54 | * @return static |
||
55 | */ |
||
56 | public static function load($id) |
||
64 | |||
65 | |||
66 | /** |
||
67 | * Build a new type to be registered. |
||
68 | * |
||
69 | * @param $id |
||
70 | * |
||
71 | * @return mixed |
||
72 | */ |
||
73 | static function build($id) |
||
77 | |||
78 | /** |
||
79 | * Get the post type identifier (aka: name/slug). |
||
80 | */ |
||
81 | public function id() |
||
85 | |||
86 | /** |
||
87 | * Checks if a post type with this slug has been registered. |
||
88 | * |
||
89 | * @param string $id The post type identifier |
||
90 | * |
||
91 | * @return bool |
||
92 | */ |
||
93 | public static function exists($id) |
||
97 | |||
98 | /** |
||
99 | * Check for feature support. |
||
100 | * |
||
101 | * @param string|array $features string - First feature of possible many, |
||
102 | * array - Many features to check support for. |
||
103 | * |
||
104 | * @return mixed |
||
105 | */ |
||
106 | public function supports($features) |
||
117 | |||
118 | /** |
||
119 | * Register support of certain features for an existing post type. |
||
120 | * |
||
121 | * @param mixed $features string - single feature to add |
||
122 | * array - multiple features to add |
||
123 | * |
||
124 | * @return $this |
||
125 | */ |
||
126 | public function addSupportFor($features) |
||
132 | |||
133 | /** |
||
134 | * Un-register support of certain features for an existing post type. |
||
135 | * |
||
136 | * @param mixed $features string - single feature to remove |
||
137 | * array - multiple features to remove |
||
138 | * |
||
139 | * @return $this |
||
140 | */ |
||
141 | public function removeSupportFor($features) |
||
150 | |||
151 | /** |
||
152 | * Unregister the post type. |
||
153 | * |
||
154 | * @throws NonExistentPostTypeException |
||
155 | * @throws WP_ErrorException |
||
156 | * |
||
157 | * @return $this |
||
158 | */ |
||
159 | public function unregister() |
||
173 | } |
||
174 |