WordPress.org

Make WordPress Core

Changeset 42708


Ignore:
Timestamp:
02/13/2018 03:37:07 PM (2 years ago)
Author:
atimmer
Message:

Docs: Improve JSDoc for wp-admin/js/user-suggest.js.

Props timhavinga.
Fixes #43270.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/user-suggest.js

    r27046 r42708  
    11/* global ajaxurl, current_site_id, isRtl */
     2/**
     3 * Suggests users in a multisite environment.
     4 *
     5 * For input fields where the admin can select a user based on email or
     6 * username, this script shows an autocompletion menu for these inputs. Should
     7 * only be used in a multisite environment. Only users in the currently active
     8 * site are shown.
     9 *
     10 * @since 3.4.0
     11 */
    212
    313(function( $ ) {
     
    919            position.at = 'right bottom';
    1020        }
     21
     22        /**
     23         * Adds an autocomplete function to input fields marked with the class
     24         * 'wp-suggest-user'.
     25         *
     26         * A minimum of two characters is required to trigger
     27         * the suggestions. The autocompletion menu is shown at the left bottom of the input
     28         * field. On RTL installations, it is shown at the right top.
     29         * Adds the class 'open' to the input field when the autocompletion menu
     30         * is shown.
     31         *
     32         * Does a backend call to retrieve the users.
     33         *
     34         * Optional data-attributes:
     35         * - data-autocomplete-type (add, search)
     36         *   The action that is going to be performed: search for existing users
     37         *   or add a new one. Default: add
     38         * - data-autocomplete-field (user_login, user_email)
     39         *   The field that is returned as the value for the suggestion.
     40         *   Default: user_login
     41         *
     42         * @see wp-admin/includes/admin-actions.php:wp_ajax_autocomplete_user()
     43         */
    1144        $( '.wp-suggest-user' ).each( function(){
    1245            var $this = $( this ),
Note: See TracChangeset for help on using the changeset viewer.