Commit Graph

12 Commits

Author SHA1 Message Date
Sergey Biryukov
001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
K. Adam White
ed11103f39 REST API: Ensure rest_controller instantiates the post type's declared REST controller class.
Ensures that the ::get_rest_controller() method will always return an instanceof the expected controller class, or null.
Removes unused private static property $post_type_controllers.

Props dlh, TimothyBlynJacobs.
Fixes #45677.


Built from https://develop.svn.wordpress.org/trunk@46435


git-svn-id: http://core.svn.wordpress.org/trunk@46233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-08 13:43:02 +00:00
K. Adam White
10772e8499 REST API: Introduce WP_Post_Type::get_rest_controller() caching method to prevent unnecessary REST controller construction.
Cache REST controller references on their associated post type object to prevent unnecessary controller re-instantiation, which previously caused "rest_prepare_{$post_type}" and "rest_{$post_type}_query" to run twice per request.

Props TimothyBlynJacobs, patrelentlesstechnologycom.
Fixes #45677.

Built from https://develop.svn.wordpress.org/trunk@46272


git-svn-id: http://core.svn.wordpress.org/trunk@46084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 20:25:57 +00:00
desrosj
a969ce8edf Posts, Post Types: Allow support arguments to be specified when registering post types.
The `add_post_type_support()` function accepts an optional third parameter that allows extra arguments to be supplied to configure post type support for a given feature. However, because of how `register_post_type()` and `WP_Post_Type->add_supports()` work, it is currently impossible to pass these additional arguments when initially registering a post type with `register_post_type()`.

This change makes it possible to supply additional arguments for a feature using the `supports` argument of `register_post_type()`.

Props MaximeCulea, seuser, desrosj, johnbillion.
Fixes #40413.
Built from https://develop.svn.wordpress.org/trunk@46160


git-svn-id: http://core.svn.wordpress.org/trunk@45972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-17 19:58:56 +00:00
Sergey Biryukov
b1e34ccc1f Docs: Add missing description for $wp_rewrite global.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45735


git-svn-id: http://core.svn.wordpress.org/trunk@45546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:19:56 +00:00
Drew Jaynes
0860bb2771 Docs: Remove @access notations from method DocBlocks in wp-includes/* classes.
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.

See #41452.

Built from https://develop.svn.wordpress.org/trunk@41162


git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 00:41:44 +00:00
Pascal Birchler
9ebebe5d25 Posts, Post Types: Add missing REST API properties to WP_Post_Type class.
Props danielbachhuber.
Fixes #39986.
Built from https://develop.svn.wordpress.org/trunk@40302


git-svn-id: http://core.svn.wordpress.org/trunk@40209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-18 15:17:45 +00:00
Sergey Biryukov
d4d8ae2422 Docs: Use a third-person singular verb for register_post_type_args filter added in [34242].
See #37770.
Built from https://develop.svn.wordpress.org/trunk@38610


git-svn-id: http://core.svn.wordpress.org/trunk@38553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-14 21:58:29 +00:00
Weston Ruter
11cb0cfe86 Docs: Correct type of WP_Post_Type::$cap from array to object.
Fixes typo introduced in r37890. The `WP_Post_Type::$cap` property is set to the return value of `get_post_type_capabilities()` which is an `object`.

See #36217.

Built from https://develop.svn.wordpress.org/trunk@38097


git-svn-id: http://core.svn.wordpress.org/trunk@38038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-18 22:52:29 +00:00
Drew Jaynes
60de6917fb Docs: Add and clarify changelog entries for elements that can now accept, use, or return WP_Post_Type objects.
Also adds a missing initial `@since` version for `wp_xmlrpc_server::_prepare_post_type()`.

See [37890]. See #36217.

Built from https://develop.svn.wordpress.org/trunk@38051


git-svn-id: http://core.svn.wordpress.org/trunk@37992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 15:24:28 +00:00
Drew Jaynes
844ae66820 Docs: The $labels property in WP_Post_Type is of type object as returned from get_post_type_labels(), not an array.
Props swissspidy.
See #36217.

Built from https://develop.svn.wordpress.org/trunk@38030


git-svn-id: http://core.svn.wordpress.org/trunk@37971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-10 17:41:30 +00:00
Dominik Schilling
60dc856d64 Posts: Introduce WP_Post_Type and use it in register_post_type() and unregister_post_type().
This changes the global `$wp_post_types` to an array of `WP_Post_Type` objects. `WP_Post_Type` includes methods to handle post type supports, rewrite rules, meta boxes, hooks, and taxonomies.
Each post type argument becomes a property of `WP_Post_Type`.

Props swissspidy, flixos90.
Fixes #36217.
Built from https://develop.svn.wordpress.org/trunk@37890


git-svn-id: http://core.svn.wordpress.org/trunk@37831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 16:41:35 +00:00