Make WordPress Core

10/23/2020 12:41:15 AM (4 years ago)

Docs: Document the return value of wp_prepare_attachment_for_js() using hash notation.

Props stevenlinx, Mista-Flo, johnbillion.
Fixes #50835.

1 edited


  • trunk/src/wp-includes/media.php

    r49234 r49281  
    37683768 *
    37693769 * @param int|WP_Post $attachment Attachment ID or object.
    3770  * @return array|void Array of attachment details.
     3770 * @return array|void {
     3771 *     Array of attachment details, or void if the parameter does not correspond to an attachment.
     3772 *
     3773 *     @type string $alt                   Alt text of the attachment.
     3774 *     @type string $author                ID of the attachment author, as a string.
     3775 *     @type string $authorName            Name of the attachment author.
     3776 *     @type string $caption               Caption for the attachment.
     3777 *     @type array  $compat                Containing item and meta.
     3778 *     @type string $context               Context, whether it's used as the site icon for example.
     3779 *     @type int    $date                  Uploaded date, timestamp in milliseconds.
     3780 *     @type string $dateFormatted         Formatted date (e.g. June 29, 2018).
     3781 *     @type string $description           Description of the attachment.
     3782 *     @type string $editLink              URL to the edit page for the attachment.
     3783 *     @type string $filename              File name of the attachment.
     3784 *     @type string $filesizeHumanReadable Filesize of the attachment in human readable format (e.g. 1 MB).
     3785 *     @type int    $filesizeInBytes       Filesize of the attachment in bytes.
     3786 *     @type int    $height                If the attachment is an image, represents the height of the image in pixels.
     3787 *     @type string $icon                  Icon URL of the attachment (e.g. /wp-includes/images/media/archive.png).
     3788 *     @type int    $id                    ID of the attachment.
     3789 *     @type string $link                  URL to the attachment.
     3790 *     @type int    $menuOrder             Menu order of the attachment post.
     3791 *     @type array  $meta                  Meta data for the attachment.
     3792 *     @type string $mime                  Mime type of the attachment (e.g. image/jpeg or application/zip).
     3793 *     @type int    $modified              Last modified, timestamp in milliseconds.
     3794 *     @type string $name                  Name, same as title of the attachment.
     3795 *     @type array  $nonces                Nonces for update, delete and edit.
     3796 *     @type string $orientation           If the attachment is an image, represents the image orientation
     3797 *                                         (landscape or portrait).
     3798 *     @type array  $sizes                 If the attachment is an image, contains an array of arrays
     3799 *                                         for the images sizes: thumbnail, medium, large, and full.
     3800 *     @type string $status                Post status of the attachment (usually 'inherit').
     3801 *     @type string $subtype               Mime subtype of the attachment (usually the last part, e.g. jpeg or zip).
     3802 *     @type string $title                 Title of the attachment (usually slugified file name without the extension).
     3803 *     @type string $type                  Type of the attachment (usually first part of the mime type, e.g. image).
     3804 *     @type int    $uploadedTo            Parent post to which the attachment was uploaded.
     3805 *     @type string $uploadedToLink        URL to the edit page of the parent post of the attachment.
     3806 *     @type string $uploadedToTitle       Post title of the parent of the attachment.
     3807 *     @type string $url                   Direct URL to the attachment file (from wp-content).
     3808 *     @type int    $width                 If the attachment is an image, represents the width of the image in pixels.
     3809 * }
     3810 *
    37713811 */
    37723812function wp_prepare_attachment_for_js( $attachment ) {
    40004040     * @since 3.5.0
    40014041     *
    4002      * @param array       $response   Array of prepared attachment data.
     4042     * @param array       $response   Array of prepared attachment data. @see wp_prepare_attachment_for_js().
    40034043     * @param WP_Post     $attachment Attachment object.
    40044044     * @param array|false $meta       Array of attachment meta data, or false if there is none.
Note: See TracChangeset for help on using the changeset viewer.