Changeset 54215 for trunk/src/wp-admin/includes/class-wp-list-table.php
- Timestamp:
- 09/19/2022 09:06:08 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-list-table.php
r54133 r54215 1515 1515 1516 1516 /** 1517 * Generates views links. 1518 * 1519 * @since 6.1.0 1520 * 1521 * @param array $link_data { 1522 * An array of link data. 1523 * 1524 * @type string $url The link URL. 1525 * @type string $label The link label. 1526 * @type bool $current Optional. Whether this is the currently selected view. 1527 * } 1528 * @return array An array of link markup. Keys match the $link_data input array. 1529 */ 1530 protected function get_views_links( $link_data = array() ) { 1531 if ( ! is_array( $link_data ) ) { 1532 _doing_it_wrong( 1533 __METHOD__, 1534 sprintf( 1535 /* translators: %s: The $link_data argument. */ 1536 __( 'The <code>%s</code> argument must be an array.' ), 1537 '$link_data' 1538 ), 1539 '6.1.0' 1540 ); 1541 1542 return array( '' ); 1543 } 1544 1545 $views_links = array(); 1546 foreach ( $link_data as $view => $link ) { 1547 if ( empty( $link['url'] ) || ! is_string( $link['url'] ) || '' === trim( $link['url'] ) ) { 1548 _doing_it_wrong( 1549 __METHOD__, 1550 sprintf( 1551 /* translators: %1$s: The argument name. %2$s: The view name. */ 1552 __( 'The <code>%1$s</code> argument must be a non-empty string for <code>%2$s</code>.' ), 1553 'url', 1554 esc_html( $view ) 1555 ), 1556 '6.1.0' 1557 ); 1558 1559 continue; 1560 } 1561 1562 if ( empty( $link['label'] ) || ! is_string( $link['label'] ) || '' === trim( $link['label'] ) ) { 1563 _doing_it_wrong( 1564 __METHOD__, 1565 sprintf( 1566 /* translators: %1$s: The argument name. %2$s: The view name. */ 1567 __( 'The <code>%1$s</code> argument must be a non-empty string for <code>%2$s</code>.' ), 1568 'label', 1569 esc_html( $view ) 1570 ), 1571 '6.1.0' 1572 ); 1573 1574 continue; 1575 } 1576 1577 $views_links[ $view ] = sprintf( 1578 '<a href="%s"%s>%s</a>', 1579 esc_url( $link['url'] ), 1580 isset( $link['current'] ) && true === $link['current'] ? ' class="current" aria-current="page"' : '', 1581 $link['label'] 1582 ); 1583 } 1584 1585 return $views_links; 1586 } 1587 1588 /** 1517 1589 * Sends required variables to JavaScript land. 1518 1590 *
Note: See TracChangeset
for help on using the changeset viewer.