WordPress.org

Make WordPress Core

Changeset 39031


Ignore:
Timestamp:
10/30/2016 06:06:23 PM (5 years ago)
Author:
DrewAPicture
Message:

Docs: Add much more complete and syntactically correct documentation throughout the WP_REST_Taxonomies_Controller class.

Props Soean, mrahmadawais, flixos90.
See #38398.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php

    r38832 r39031  
    11<?php
    2 
     2/**
     3 * REST API: WP_REST_Taxonomies_Controller class
     4 *
     5 * @package WordPress
     6 * @subpackage REST_API
     7 * @since 4.7.0
     8 */
     9
     10/**
     11 * Core class used to manage taxonomies via the REST API.
     12 *
     13 * @since 4.7.0
     14 *
     15 * @see WP_REST_Controller
     16 */
    317class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
    418
     19    /**
     20     * Constructor.
     21     *
     22     * @since 4.7.0
     23     * @access public
     24     */
    525    public function __construct() {
    626        $this->namespace = 'wp/v2';
     
    929
    1030    /**
    11      * Register the routes for the objects of the controller.
     31     * Registers the routes for the objects of the controller.
     32     *
     33     * @since 4.7.0
     34     * @access public
     35     *
     36     * @see register_rest_route()
    1237     */
    1338    public function register_routes() {
     
    3762
    3863    /**
    39      * Check whether a given request has permission to read taxonomies.
    40      *
    41      * @param  WP_REST_Request $request Full details about the request.
    42      * @return WP_Error|boolean
     64     * Checks whether a given request has permission to read taxonomies.
     65     *
     66     * @since 4.7.0
     67     * @access public
     68     *
     69     * @param WP_REST_Request $request Full details about the request.
     70     * @return true|WP_Error True if the request has read access, WP_Error object otherwise.
    4371     */
    4472    public function get_items_permissions_check( $request ) {
     
    6088
    6189    /**
    62      * Get all public taxonomies
    63      *
    64      * @param WP_REST_Request $request
    65      * @return array
     90     * Retrieves all public taxonomies.
     91     *
     92     * @since 4.7.0
     93     * @access public
     94     *
     95     * @param WP_REST_Request $request Full details about the request.
     96     * @return WP_REST_Response Response object on success, or WP_Error object on failure.
    6697     */
    6798    public function get_items( $request ) {
     
    94125
    95126    /**
    96      * Check if a given request has access a taxonomy
     127     * Checks if a given request has access to a taxonomy.
     128     *
     129     * @since 4.7.0
     130     * @access public
    97131     *
    98132     * @param  WP_REST_Request $request Full details about the request.
    99      * @return WP_Error|boolean
     133     * @return true|WP_Error True if the request has read access for the item, otherwise false or WP_Error object.
    100134     */
    101135    public function get_item_permissions_check( $request ) {
     
    116150
    117151    /**
    118      * Get a specific taxonomy
    119      *
    120      * @param WP_REST_Request $request
    121      * @return array|WP_Error
     152     * Retrieves a specific taxonomy.
     153     *
     154     * @since 4.7.0
     155     * @access public
     156     *
     157     * @param WP_REST_Request $request Full details about the request.
     158     * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
    122159     */
    123160    public function get_item( $request ) {
     
    131168
    132169    /**
    133      * Prepare a taxonomy object for serialization
    134      *
    135      * @param stdClass $taxonomy Taxonomy data
    136      * @param WP_REST_Request $request
    137      * @return WP_REST_Response $response
     170     * Prepares a taxonomy object for serialization.
     171     *
     172     * @since 4.7.0
     173     * @access public
     174     *
     175     * @param stdClass        $taxonomy Taxonomy data.
     176     * @param WP_REST_Request $request  Full details about the request.
     177     * @return WP_REST_Response Response object.
    138178     */
    139179    public function prepare_item_for_response( $taxonomy, $request ) {
     
    168208
    169209        /**
    170          * Filter a taxonomy returned from the API.
     210         * Filters a taxonomy returned from the REST API.
    171211         *
    172212         * Allows modification of the taxonomy data right before it is returned.
    173213         *
    174          * @param WP_REST_Response  $response   The response object.
    175          * @param object            $item       The original taxonomy object.
    176          * @param WP_REST_Request   $request    Request used to generate the response.
     214         * @since 4.7.0
     215         *
     216         * @param WP_REST_Response $response The response object.
     217         * @param object           $item     The original taxonomy object.
     218         * @param WP_REST_Request  $request  Request used to generate the response.
    177219         */
    178220        return apply_filters( 'rest_prepare_taxonomy', $response, $taxonomy, $request );
     
    180222
    181223    /**
    182      * Get the taxonomy's schema, conforming to JSON Schema
    183      *
    184      * @return array
     224     * Retrieves the taxonomy's schema, conforming to JSON Schema.
     225     *
     226     * @since 4.7.0
     227     * @access public
     228     *
     229     * @return array Item schema data.
    185230     */
    186231    public function get_item_schema() {
     
    244289
    245290    /**
    246      * Get the query params for collections
    247      *
    248      * @return array
     291     * Retrieves the query params for collections.
     292     *
     293     * @since 4.7.0
     294     * @access public
     295     *
     296     * @return array Collection parameters.
    249297     */
    250298    public function get_collection_params() {
Note: See TracChangeset for help on using the changeset viewer.