Make WordPress Core

Changeset 51320


Ignore:
Timestamp:
07/02/2021 07:07:01 PM (3 years ago)
Author:
desrosj
Message:

Twenty Twenty-One: Add missing documentation for some filters.

Add missing @since tags for some functions.

Follow-up to [49216], [49220], [49854], [51294].

Props SergeyBiryukov.
Merges [51304] to the 5.8 branch.
See #52628, #53461.

Location:
branches/5.8
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-content/themes/twentytwentyone/assets/js/customize-helpers.js

    r49575 r51320  
    11/**
    22 * Get luminance from a HEX color.
     3 *
     4 * @since Twenty Twenty-One 1.0
    35 *
    46 * @param {string} hex - The hex color.
     
    1315/**
    1416 * Get RGB from HEX.
     17 *
     18 * @since Twenty Twenty-One 1.0
    1519 *
    1620 * @param {string} hex - The hex color.
  • branches/5.8/src/wp-content/themes/twentytwentyone/assets/js/palette-colorpicker.js

    r49216 r51320  
    66 *      Removed the hue picker script because we don't use it here
    77 *      Added the "palettes" argument in wpColorPicker().
     8 *
     9 * @since Twenty Twenty-One 1.0
    810 */
    911wp.customize.controlConstructor['twenty-twenty-one-color'] = wp.customize.Control.extend( {
  • branches/5.8/src/wp-content/themes/twentytwentyone/assets/js/polyfills.js

    r49320 r51320  
    77/**
    88 * Polyfill for Element.closest() because we need to support IE11.
     9 *
     10 * @since Twenty Twenty-One 1.0
    911 *
    1012 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
     
    3032 * Polyfill for NodeList.foreach() because we need to support IE11.
    3133 *
     34 * @since Twenty Twenty-One 1.0
     35 *
    3236 * @see https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach
    3337 */
  • branches/5.8/src/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js

    r51072 r51320  
    77/**
    88 * Toggle an attribute's value
     9 *
     10 * @since Twenty Twenty-One 1.0
    911 *
    1012 * @param {Element} el - The element.
    1113 * @param {boolean} withListeners - Whether we want to add/remove listeners or not.
    12  * @since Twenty Twenty-One 1.0
    1314 */
    1415function twentytwentyoneToggleAriaExpanded( el, withListeners ) {
     
    3839 * Changes the position of submenus so they always fit the screen horizontally.
    3940 *
     41 * @since Twenty Twenty-One 1.0
     42 *
    4043 * @param {Element} li - The li element.
    4144 */
     
    6669 * Handle clicks on submenu toggles.
    6770 *
     71 * @since Twenty Twenty-One 1.0
     72 *
    6873 * @param {Element} el - The element.
    6974 */
     
    9297    /**
    9398     * Menu Toggle Behaviors
     99     *
     100     * @since Twenty Twenty-One 1.0
    94101     *
    95102     * @param {string} id - The ID.
     
    113120            };
    114121        }
     122
    115123        /**
    116124         * Trap keyboard navigation in the menu modal.
    117          * Adapted from TwentyTwenty
     125         * Adapted from Twenty Twenty.
     126         *
     127         * @since Twenty Twenty-One 1.0
    118128         */
    119129        document.addEventListener( 'keydown', function( event ) {
     
    159169        /**
    160170         * Close menu and scroll to anchor when an anchor link is clicked.
    161          * Adapted from TwentyTwenty.
     171         * Adapted from Twenty Twenty.
     172         *
     173         * @since Twenty Twenty-One 1.1
    162174         */
    163175        document.addEventListener( 'click', function( event ) {
  • branches/5.8/src/wp-content/themes/twentytwentyone/assets/js/skip-link-focus-fix.js

    r49216 r51320  
    77 *
    88 * Learn more: https://git.io/vWdr2
     9 *
     10 * @since Twenty Twenty-One 1.0
    911 */
    1012( function() {
  • branches/5.8/src/wp-content/themes/twentytwentyone/functions.php

    r49865 r51320  
    9696        );
    9797
    98         /**
     98        /*
    9999         * Add support for core custom logo.
    100100         *
     
    486486 * thus it does not warrant having an entire dedicated blocking script being loaded.
    487487 *
     488 * @since Twenty Twenty-One 1.0
     489 *
    488490 * @link https://git.io/vWdr2
    489491 */
     
    604606 */
    605607function twentytwentyone_the_html_classes() {
     608    /**
     609     * Filters the classes for the main <html> element.
     610     *
     611     * @since Twenty Twenty-One 1.0
     612     *
     613     * @param string The list of classes. Default empty string.
     614     */
    606615    $classes = apply_filters( 'twentytwentyone_html_classes', '' );
    607616    if ( ! $classes ) {
  • branches/5.8/src/wp-content/themes/twentytwentyone/image.php

    r50233 r51320  
    2525                 * Filter the default image attachment size.
    2626                 *
    27                  * @param string $image_size Image size. Default 'large'.
     27                 * @since Twenty Twenty-One 1.0
     28                 *
     29                 * @param string $image_size Image size. Default 'full'.
    2830                 */
    2931                $image_size = apply_filters( 'twenty_twenty_one_attachment_size', 'full' );
  • branches/5.8/src/wp-content/themes/twentytwentyone/inc/menu-functions.php

    r51319 r51320  
    5555 * Displays SVG icons in the footer navigation.
    5656 *
     57 * @since Twenty Twenty-One 1.0
     58 *
    5759 * @param string   $item_output The menu item's starting HTML output.
    5860 * @param WP_Post  $item        Menu item data object.
  • branches/5.8/src/wp-content/themes/twentytwentyone/inc/template-functions.php

    r51319 r51320  
    104104 */
    105105function twenty_twenty_one_can_show_post_thumbnail() {
     106    /**
     107     * Filters whether post thumbnail can be displayed.
     108     *
     109     * @since Twenty Twenty-One 1.0
     110     *
     111     * @param bool $show_post_thumbnail Whether to show post thumbnail.
     112     */
    106113    return apply_filters(
    107114        'twenty_twenty_one_can_show_post_thumbnail',
     
    122129
    123130/**
    124  * Creates continue reading text
     131 * Creates continue reading text.
     132 *
     133 * @since Twenty Twenty-One 1.0
    125134 */
    126135function twenty_twenty_one_continue_reading_text() {
     
    135144
    136145/**
    137  * Create the continue reading link for excerpt.
     146 * Creates the continue reading link for excerpt.
     147 *
     148 * @since Twenty Twenty-One 1.0
    138149 */
    139150function twenty_twenty_one_continue_reading_link_excerpt() {
     
    147158
    148159/**
    149  * Create the continue reading link.
     160 * Creates the continue reading link.
     161 *
     162 * @since Twenty Twenty-One 1.0
    150163 */
    151164function twenty_twenty_one_continue_reading_link() {
     
    160173if ( ! function_exists( 'twenty_twenty_one_post_title' ) ) {
    161174    /**
    162      * Add a title to posts and pages that are missing titles.
     175     * Adds a title to posts and pages that are missing titles.
    163176     *
    164177     * @since Twenty Twenty-One 1.0
     
    190203 * Changes the default navigation arrows to svg icons
    191204 *
     205 * @since Twenty Twenty-One 1.0
     206 *
    192207 * @param string $calendar_output The generated HTML of the calendar.
    193208 * @return string
     
    205220 * Return CSS for non-latin language, if available, or null
    206221 *
    207  * @param string $type Whether to return CSS for the "front-end", "block-editor" or "classic-editor".
     222 * @since Twenty Twenty-One 1.0
     223 *
     224 * @param string $type Whether to return CSS for the "front-end", "block-editor", or "classic-editor".
    208225 * @return string
    209226 */
     
    213230    $locale = get_bloginfo( 'language' );
    214231
    215     // Define fallback fonts for non-latin languages.
     232    /**
     233     * Filters the fallback fonts for non-latin languages.
     234     *
     235     * @since Twenty Twenty-One 1.0
     236     *
     237     * @param array $font_family An array of locales and font families.
     238     */
    216239    $font_family = apply_filters(
    217240        'twenty_twenty_one_get_localized_font_family_types',
     
    283306    }
    284307
    285     // Define elements to apply fallback fonts to.
     308    /**
     309     * Filters the elements to apply fallback fonts to.
     310     *
     311     * @since Twenty Twenty-One 1.0
     312     *
     313     * @param array $elements An array of elements for "front-end", "block-editor", or "classic-editor".
     314     */
    286315    $elements = apply_filters(
    287316        'twenty_twenty_one_get_localized_font_family_elements',
     
    369398
    370399    if ( $blocks_content ) {
     400        /** This filter is documented in wp-includes/post-template.php */
    371401        echo apply_filters( 'the_content', $blocks_content ); // phpcs:ignore WordPress.Security.EscapeOutput
    372402        return true;
Note: See TracChangeset for help on using the changeset viewer.