WordPress.org

Make WordPress Core

Changeset 35731


Ignore:
Timestamp:
11/23/2015 05:55:24 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve DocBlock formatting for add_menu_page() and add_submenu_page() wrappers.

See #34360.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/plugin.php

    r35669 r35731  
    10141014
    10151015/**
    1016  * Add a top level menu page
     1016 * Add a top-level menu page.
    10171017 *
    10181018 * This function takes a capability which will be used to determine whether
     
    10271027 * @global array $_parent_pages
    10281028 *
    1029  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1030  * @param string $menu_title The text to be used for the menu
    1031  * @param string $capability The capability required for this menu to be displayed to the user.
    1032  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1033  * @param callable $function The function to be called to output the content for this page.
    1034  * @param string $icon_url The url to the icon to be used for this menu.
    1035  *     * Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme.
    1036  *       This should begin with 'data:image/svg+xml;base64,'.
    1037  *     * Pass the name of a Dashicons helper class to use a font icon, e.g. 'dashicons-chart-pie'.
    1038  *     * Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS.
    1039  * @param int $position The position in the menu order this one should appear
    1040  *
    1041  * @return string The resulting page's hook_suffix
     1029 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1030 * @param string   $menu_title The text to be used for the menu.
     1031 * @param string   $capability The capability required for this menu to be displayed to the user.
     1032 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1033 * @param callable $function   The function to be called to output the content for this page.
     1034 * @param string   $icon_url   The URL to the icon to be used for this menu.
     1035 *                             * Pass a base64-encoded SVG using a data URI, which will be colored to match
     1036 *                               the color scheme. This should begin with 'data:image/svg+xml;base64,'.
     1037 *                             * Pass the name of a Dashicons helper class to use a font icon,
     1038 *                               e.g. 'dashicons-chart-pie'.
     1039 *                             * Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS.
     1040 * @param int      $position   The position in the menu order this one should appear.
     1041 * @return string The resulting page's hook_suffix.
    10421042 */
    10431043function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '', $position = null ) {
     
    10811081
    10821082/**
    1083  * Add a top level menu page in the 'objects' section
     1083 * Add a top-level menu page in the 'objects' section.
    10841084 *
    10851085 * This function takes a capability which will be used to determine whether
     
    10911091 * @global int $_wp_last_object_menu
    10921092 *
    1093  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1094  * @param string $menu_title The text to be used for the menu
    1095  * @param string $capability The capability required for this menu to be displayed to the user.
    1096  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1097  * @param callable $function The function to be called to output the content for this page.
    1098  * @param string $icon_url The url to the icon to be used for this menu
    1099  *
    1100  * @return string The resulting page's hook_suffix
     1093 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1094 * @param string   $menu_title The text to be used for the menu.
     1095 * @param string   $capability The capability required for this menu to be displayed to the user.
     1096 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1097 * @param callable $function   The function to be called to output the content for this page.
     1098 * @param string   $icon_url   The url to the icon to be used for this menu.
     1099 * @return string The resulting page's hook_suffix.
    11011100 */
    11021101function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
     
    11091108
    11101109/**
    1111  * Add a top level menu page in the 'utility' section
     1110 * Add a top-level menu page in the 'utility' section.
    11121111 *
    11131112 * This function takes a capability which will be used to determine whether
     
    11191118 * @global int $_wp_last_utility_menu
    11201119 *
    1121  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1122  * @param string $menu_title The text to be used for the menu
    1123  * @param string $capability The capability required for this menu to be displayed to the user.
    1124  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1125  * @param callable $function The function to be called to output the content for this page.
    1126  * @param string $icon_url The url to the icon to be used for this menu
    1127  *
    1128  * @return string The resulting page's hook_suffix
     1120 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1121 * @param string   $menu_title The text to be used for the menu.
     1122 * @param string   $capability The capability required for this menu to be displayed to the user.
     1123 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1124 * @param callable $function   The function to be called to output the content for this page.
     1125 * @param string   $icon_url   The url to the icon to be used for this menu.
     1126 * @return string The resulting page's hook_suffix.
    11291127 */
    11301128function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
     
    11371135
    11381136/**
    1139  * Add a sub menu page
     1137 * Add a submenu page.
    11401138 *
    11411139 * This function takes a capability which will be used to determine whether
     
    11481146 * @global array $menu
    11491147 * @global array $_wp_real_parent_file
    1150  * @global bool $_wp_submenu_nopriv
     1148 * @global bool  $_wp_submenu_nopriv
    11511149 * @global array $_registered_pages
    11521150 * @global array $_parent_pages
    11531151 *
    1154  * @param string $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page)
    1155  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1156  * @param string $menu_title The text to be used for the menu
    1157  * @param string $capability The capability required for this menu to be displayed to the user.
    1158  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1159  * @param callable $function The function to be called to output the content for this page.
    1160  *
     1152 * @param string   $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page).
     1153 * @param string   $page_title  The text to be displayed in the title tags of the page when the menu is selected.
     1154 * @param string   $menu_title  The text to be used for the menu.
     1155 * @param string   $capability  The capability required for this menu to be displayed to the user.
     1156 * @param string   $menu_slug   The slug name to refer to this menu by (should be unique for this menu).
     1157 * @param callable $function    The function to be called to output the content for this page.
    11611158 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    11621159 */
     
    12111208
    12121209/**
    1213  * Add sub menu page to the Tools main menu.
     1210 * Add submenu page to the Tools main menu.
    12141211 *
    12151212 * This function takes a capability which will be used to determine whether
     
    12191216 * that the user has the required capability as well.
    12201217 *
    1221  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1222  * @param string $menu_title The text to be used for the menu
    1223  * @param string $capability The capability required for this menu to be displayed to the user.
    1224  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1225  * @param callable $function The function to be called to output the content for this page.
    1226  *
     1218 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1219 * @param string   $menu_title The text to be used for the menu.
     1220 * @param string   $capability The capability required for this menu to be displayed to the user.
     1221 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1222 * @param callable $function   The function to be called to output the content for this page.
    12271223 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    12281224 */
     
    12321228
    12331229/**
    1234  * Add sub menu page to the Settings main menu.
     1230 * Add submenu page to the Settings main menu.
    12351231 *
    12361232 * This function takes a capability which will be used to determine whether
     
    12401236 * that the user has the required capability as well.
    12411237 *
    1242  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1243  * @param string $menu_title The text to be used for the menu
    1244  * @param string $capability The capability required for this menu to be displayed to the user.
    1245  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1246  * @param callable $function The function to be called to output the content for this page.
    1247  *
     1238 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1239 * @param string   $menu_title The text to be used for the menu.
     1240 * @param string   $capability The capability required for this menu to be displayed to the user.
     1241 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1242 * @param callable $function   The function to be called to output the content for this page.
    12481243 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    12491244 */
     
    12531248
    12541249/**
    1255  * Add sub menu page to the Appearance main menu.
     1250 * Add submenu page to the Appearance main menu.
    12561251 *
    12571252 * This function takes a capability which will be used to determine whether
     
    12611256 * that the user has the required capability as well.
    12621257 *
    1263  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1264  * @param string $menu_title The text to be used for the menu
    1265  * @param string $capability The capability required for this menu to be displayed to the user.
    1266  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1267  * @param callable $function The function to be called to output the content for this page.
    1268  *
     1258 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1259 * @param string   $menu_title The text to be used for the menu.
     1260 * @param string   $capability The capability required for this menu to be displayed to the user.
     1261 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1262 * @param callable $function   The function to be called to output the content for this page.
    12691263 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    12701264 */
     
    12741268
    12751269/**
    1276  * Add sub menu page to the Plugins main menu.
     1270 * Add submenu page to the Plugins main menu.
    12771271 *
    12781272 * This function takes a capability which will be used to determine whether
     
    12821276 * that the user has the required capability as well.
    12831277 *
    1284  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1285  * @param string $menu_title The text to be used for the menu
    1286  * @param string $capability The capability required for this menu to be displayed to the user.
    1287  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1288  * @param callable $function The function to be called to output the content for this page.
    1289  *
     1278 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1279 * @param string   $menu_title The text to be used for the menu.
     1280 * @param string   $capability The capability required for this menu to be displayed to the user.
     1281 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1282 * @param callable $function   The function to be called to output the content for this page.
    12901283 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    12911284 */
     
    12951288
    12961289/**
    1297  * Add sub menu page to the Users/Profile main menu.
     1290 * Add submenu page to the Users/Profile main menu.
    12981291 *
    12991292 * This function takes a capability which will be used to determine whether
     
    13031296 * that the user has the required capability as well.
    13041297 *
    1305  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1306  * @param string $menu_title The text to be used for the menu
    1307  * @param string $capability The capability required for this menu to be displayed to the user.
    1308  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1309  * @param callable $function The function to be called to output the content for this page.
    1310  *
     1298 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1299 * @param string   $menu_title The text to be used for the menu.
     1300 * @param string   $capability The capability required for this menu to be displayed to the user.
     1301 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1302 * @param callable $function   The function to be called to output the content for this page.
    13111303 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    13121304 */
     
    13191311}
    13201312/**
    1321  * Add sub menu page to the Dashboard main menu.
     1313 * Add submenu page to the Dashboard main menu.
    13221314 *
    13231315 * This function takes a capability which will be used to determine whether
     
    13271319 * that the user has the required capability as well.
    13281320 *
    1329  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1330  * @param string $menu_title The text to be used for the menu
    1331  * @param string $capability The capability required for this menu to be displayed to the user.
    1332  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1333  * @param callable $function The function to be called to output the content for this page.
    1334  *
     1321 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1322 * @param string   $menu_title The text to be used for the menu.
     1323 * @param string   $capability The capability required for this menu to be displayed to the user.
     1324 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1325 * @param callable $function   The function to be called to output the content for this page.
    13351326 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    13361327 */
     
    13401331
    13411332/**
    1342  * Add sub menu page to the Posts main menu.
     1333 * Add submenu page to the Posts main menu.
    13431334 *
    13441335 * This function takes a capability which will be used to determine whether
     
    13481339 * that the user has the required capability as well.
    13491340 *
    1350  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1351  * @param string $menu_title The text to be used for the menu
    1352  * @param string $capability The capability required for this menu to be displayed to the user.
    1353  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1354  * @param callable $function The function to be called to output the content for this page.
    1355  *
     1341 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1342 * @param string   $menu_title The text to be used for the menu.
     1343 * @param string   $capability The capability required for this menu to be displayed to the user.
     1344 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1345 * @param callable $function   The function to be called to output the content for this page.
    13561346 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    13571347 */
     
    13611351
    13621352/**
    1363  * Add sub menu page to the Media main menu.
     1353 * Add submenu page to the Media main menu.
    13641354 *
    13651355 * This function takes a capability which will be used to determine whether
     
    13691359 * that the user has the required capability as well.
    13701360 *
    1371  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1372  * @param string $menu_title The text to be used for the menu
    1373  * @param string $capability The capability required for this menu to be displayed to the user.
    1374  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1375  * @param callable $function The function to be called to output the content for this page.
    1376  *
     1361 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1362 * @param string   $menu_title The text to be used for the menu.
     1363 * @param string   $capability The capability required for this menu to be displayed to the user.
     1364 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1365 * @param callable $function   The function to be called to output the content for this page.
    13771366 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    13781367 */
     
    13821371
    13831372/**
    1384  * Add sub menu page to the Links main menu.
     1373 * Add submenu page to the Links main menu.
    13851374 *
    13861375 * This function takes a capability which will be used to determine whether
     
    13901379 * that the user has the required capability as well.
    13911380 *
    1392  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1393  * @param string $menu_title The text to be used for the menu
    1394  * @param string $capability The capability required for this menu to be displayed to the user.
    1395  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1396  * @param callable $function The function to be called to output the content for this page.
    1397  *
     1381 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1382 * @param string   $menu_title The text to be used for the menu.
     1383 * @param string   $capability The capability required for this menu to be displayed to the user.
     1384 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1385 * @param callable $function   The function to be called to output the content for this page.
    13981386 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    13991387 */
     
    14031391
    14041392/**
    1405  * Add sub menu page to the Pages main menu.
     1393 * Add submenu page to the Pages main menu.
    14061394 *
    14071395 * This function takes a capability which will be used to determine whether
     
    14111399 * that the user has the required capability as well.
    14121400 *
    1413  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1414  * @param string $menu_title The text to be used for the menu
    1415  * @param string $capability The capability required for this menu to be displayed to the user.
    1416  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1417  * @param callable $function The function to be called to output the content for this page.
    1418  *
     1401 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1402 * @param string   $menu_title The text to be used for the menu.
     1403 * @param string   $capability The capability required for this menu to be displayed to the user.
     1404 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1405 * @param callable $function   The function to be called to output the content for this page.
    14191406 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    14201407*/
     
    14241411
    14251412/**
    1426  * Add sub menu page to the Comments main menu.
     1413 * Add submenu page to the Comments main menu.
    14271414 *
    14281415 * This function takes a capability which will be used to determine whether
     
    14321419 * that the user has the required capability as well.
    14331420 *
    1434  * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    1435  * @param string $menu_title The text to be used for the menu
    1436  * @param string $capability The capability required for this menu to be displayed to the user.
    1437  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1438  * @param callable $function The function to be called to output the content for this page.
    1439  *
     1421 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1422 * @param string   $menu_title The text to be used for the menu.
     1423 * @param string   $capability The capability required for this menu to be displayed to the user.
     1424 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1425 * @param callable $function   The function to be called to output the content for this page.
    14401426 * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required.
    14411427*/
     
    14451431
    14461432/**
    1447  * Remove a top level admin menu
     1433 * Remove a top-level admin menu.
    14481434 *
    14491435 * @since 3.1.0
     
    14511437 * @global array $menu
    14521438 *
    1453  * @param string $menu_slug The slug of the menu
    1454  * @return array|bool The removed menu on success, False if not found
     1439 * @param string $menu_slug The slug of the menu.
     1440 * @return array|bool The removed menu on success, false if not found.
    14551441 */
    14561442function remove_menu_page( $menu_slug ) {
     
    14681454
    14691455/**
    1470  * Remove an admin submenu
     1456 * Remove an admin submenu.
    14711457 *
    14721458 * @since 3.1.0
     
    14741460 * @global array $submenu
    14751461 *
    1476  * @param string $menu_slug The slug for the parent menu
    1477  * @param string $submenu_slug The slug of the submenu
    1478  * @return array|bool The removed submenu on success, False if not found
     1462 * @param string $menu_slug    The slug for the parent menu.
     1463 * @param string $submenu_slug The slug of the submenu.
     1464 * @return array|bool The removed submenu on success, false if not found.
    14791465 */
    14801466function remove_submenu_page( $menu_slug, $submenu_slug ) {
Note: See TracChangeset for help on using the changeset viewer.