wppaste
WordPress

wp_privacy_generate_personal_data_export_group_html( array $group_data, string $group_id = '', int $groups_count = 1 ): string

Since
4.9.6, 5.4.0
Source
wp-admin/includes/privacy-tools.php:252
Generate a single group for the personal data export report.

Parameters

$group_dataarray
The group data to render.
  • $group_labelstring

    The user-facing heading for the group, e.g. 'Comments'.
  • $itemsarray

    { An array of group items.
  • $group_item_dataarray

    { An array of name-value pairs for the item.
  • $namestring

    The user-facing name of an item name-value pair, e.g. 'IP Address'.
  • $valuestring

    The user-facing value of an item data pair, e.g. '50.60.70.0'. } }
$group_idstringoptional
The group identifier.Default: ''
$groups_countintoptional
The number of all groupsDefault: 1

Return

string
The HTML for this group and its items.

Uses · 8

Used by · 1

Source

function wp_privacy_generate_personal_data_export_group_html( $group_data, $group_id = '', $groups_count = 1 ) {	$group_id_attr = sanitize_title_with_dashes( $group_data['group_label'] . '-' . $group_id ); 	$group_html  = '<h2 id="' . esc_attr( $group_id_attr ) . '">';	$group_html .= esc_html( $group_data['group_label'] ); 	$items_count = count( (array) $group_data['items'] );	if ( $items_count > 1 ) {		$group_html .= sprintf( ' <span class="count">(%d)</span>', $items_count );	} 	$group_html .= '</h2>'; 	if ( ! empty( $group_data['group_description'] ) ) {		$group_html .= '<p>' . esc_html( $group_data['group_description'] ) . '</p>';	} 	$group_html .= '<div>'; 	foreach ( (array) $group_data['items'] as $group_item_id => $group_item_data ) {		$group_html .= '<table>';		$group_html .= '<tbody>'; 		foreach ( (array) $group_item_data as $group_item_datum ) {			$value = $group_item_datum['value'];			// If it looks like a link, make it a link.			if ( ! str_contains( $value, ' ' ) && ( str_starts_with( $value, 'http://' ) || str_starts_with( $value, 'https://' ) ) ) {				$value = '<a href="' . esc_url( $value ) . '">' . esc_html( $value ) . '</a>';			} 			$group_html .= '<tr>';			$group_html .= '<th>' . esc_html( $group_item_datum['name'] ) . '</th>';			$group_html .= '<td>' . wp_kses( $value, 'personal_data_export' ) . '</td>';			$group_html .= '</tr>';		} 		$group_html .= '</tbody>';		$group_html .= '</table>';	} 	if ( $groups_count > 1 ) {		$group_html .= '<div class="return-to-top">';		$group_html .= '<a href="#top"><span aria-hidden="true">&uarr; </span> ' . esc_html__( 'Go to top' ) . '</a>';		$group_html .= '</div>';	} 	$group_html .= '</div>'; 	return $group_html;}

History

Introduced in 4.9.6. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

5.4.0
Added the $group_id and $groups_count parameters.from the docblock
4.9.6
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-admin/includes/privacy-tools.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.